File: build-math-object.diff

package info (click to toggle)
python3.9 3.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 102,508 kB
  • sloc: python: 606,145; ansic: 515,486; xml: 31,209; sh: 4,917; cpp: 3,781; makefile: 1,885; asm: 1,486; objc: 761; lisp: 502; pascal: 360; javascript: 177; csh: 11
file content (23 lines) | stat: -rw-r--r-- 856 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -22,7 +22,8 @@
 
 MODBUILT_NAMES=    _MODBUILT_NAMES_
 MODDISABLED_NAMES= _MODDISABLED_NAMES_
-MODOBJS=           _MODOBJS_
+# filter out duplicate object files (_math.o)
+MODOBJS=           $(sort _MODOBJS_)
 MODLIBS=           _MODLIBS_
 
 # === Variables set by configure
@@ -619,8 +620,9 @@ pybuilddir.txt: $(BUILDPYTHON)
 	fi
 
 # This is shared by the math and cmath modules
+# don't build with -fPIC when building as math and cmath as builtins
 Modules/_math.o: Modules/_math.c Modules/_math.h
-	$(CC) -c $(CCSHARED) $(PY_CORE_CFLAGS) -o $@ $<
+	$(CC) -c $(if $(findstring _math.o, $(MODOBJS)),,$(CCSHARED)) $(PY_CORE_CFLAGS) -o $@ $<
 
 # blake2s is auto-generated from blake2b
 $(srcdir)/Modules/_blake2/blake2s_impl.c: $(srcdir)/Modules/_blake2/blake2b_impl.c $(srcdir)/Modules/_blake2/blake2b2s.py