summaryrefslogtreecommitdiffstats
path: root/Modules/makesetup
diff options
context:
space:
mode:
authorMalcolm Smith <smith@chaquo.com>2024-02-21 23:18:57 (GMT)
committerGitHub <noreply@github.com>2024-02-21 23:18:57 (GMT)
commit7f5e3f04f838686d65f1053a5e47f5d3faf0b228 (patch)
tree3460842977a6392fa59715777ecdf130667079c6 /Modules/makesetup
parent113687a8381d6dde179aeede607bcbca5c09d182 (diff)
downloadcpython-7f5e3f04f838686d65f1053a5e47f5d3faf0b228.zip
cpython-7f5e3f04f838686d65f1053a5e47f5d3faf0b228.tar.gz
cpython-7f5e3f04f838686d65f1053a5e47f5d3faf0b228.tar.bz2
gh-111225: Link extension modules against libpython on Android (#115780)
Part of the work on PEP 738: Adding Android as a supported platform. * Rename the LIBPYTHON variable to MODULE_LDFLAGS, to more accurately reflect its purpose. * Edit makesetup to use MODULE_LDFLAGS when linking extension modules. * Edit the Makefile so that extension modules depend on libpython on Android and Cygwin. * Restore `-fPIC` on Android. It was removed several years ago with a note that the toolchain used it automatically, but this is no longer the case. Omitting it causes all linker commands to fail with an error like `relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol '_Py_FalseStruct'; recompile with -fPIC`.
Diffstat (limited to 'Modules/makesetup')
-rwxr-xr-xModules/makesetup14
1 files changed, 1 insertions, 13 deletions
diff --git a/Modules/makesetup b/Modules/makesetup
index f000c9c..d41b664 100755
--- a/Modules/makesetup
+++ b/Modules/makesetup
@@ -87,18 +87,6 @@ esac
NL='\
'
-# Setup to link with extra libraries when making shared extensions.
-# Currently, only Cygwin needs this baggage.
-case `uname -s` in
-CYGWIN*) if test $libdir = .
- then
- ExtraLibDir=.
- else
- ExtraLibDir='$(LIBPL)'
- fi
- ExtraLibs="-L$ExtraLibDir -lpython\$(LDVERSION)";;
-esac
-
# Main loop
for i in ${*-Setup}
do
@@ -286,7 +274,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
;;
esac
rule="$file: $objs"
- rule="$rule; \$(BLDSHARED) $objs $libs $ExtraLibs -o $file"
+ rule="$rule; \$(BLDSHARED) $objs $libs \$(MODULE_LDFLAGS) -o $file"
echo "$rule" >>$rulesf
done
done