Author: Armin Rigo <[email protected]>
Branch:
Changeset: r75828:70d63dd6d506
Date: 2015-02-11 18:55 +0100
http://bitbucket.org/pypy/pypy/changeset/70d63dd6d506/
Log: Revert too much changes that were done in b782b42ddc67: we still
need to say "-Wl,--export-dynamic" in the Makefile, otherwise no
symbol is exported if we're "--no-shared".
diff --git a/rpython/translator/platform/__init__.py
b/rpython/translator/platform/__init__.py
--- a/rpython/translator/platform/__init__.py
+++ b/rpython/translator/platform/__init__.py
@@ -201,10 +201,14 @@
library_dirs = self._libdirs(library_dirs)
libraries = self._libs(eci.libraries)
link_files = self._linkfiles(eci.link_files)
- return (library_dirs + list(self.link_flags) +
+ export_flags = self._exportsymbols_link_flags()
+ return (library_dirs + list(self.link_flags) + export_flags +
link_files + list(eci.link_extra) + libraries +
list(self.extra_libs))
+ def _exportsymbols_link_flags(self):
+ return []
+
def _finish_linking(self, ofiles, eci, outputfilename, standalone):
if outputfilename is None:
outputfilename = ofiles[0].purebasename
diff --git a/rpython/translator/platform/darwin.py
b/rpython/translator/platform/darwin.py
--- a/rpython/translator/platform/darwin.py
+++ b/rpython/translator/platform/darwin.py
@@ -36,6 +36,13 @@
include_dirs = self._includedirs(eci.include_dirs)
return (args + frameworks + include_dirs)
+ def _exportsymbols_link_flags(self):
+ # XXX unsure if OS/X requires an option to the linker to tell
+ # "please export all RPY_EXPORTED symbols even in the case of
+ # making a binary and not a dynamically-linked library".
+ # It's not "-exported_symbols_list" but something close.
+ return []
+
def gen_makefile(self, cfiles, eci, exe_name=None, path=None,
shared=False, headers_to_precompile=[],
no_precompile_cfiles = []):
diff --git a/rpython/translator/platform/posix.py
b/rpython/translator/platform/posix.py
--- a/rpython/translator/platform/posix.py
+++ b/rpython/translator/platform/posix.py
@@ -43,6 +43,12 @@
def _link_args_from_eci(self, eci, standalone):
return Platform._link_args_from_eci(self, eci, standalone)
+ def _exportsymbols_link_flags(self):
+ if (self.cc == 'mingw32' or (self.cc== 'gcc' and os.name=='nt')
+ or sys.platform == 'cygwin'):
+ return ["-Wl,--export-all-symbols"]
+ return ["-Wl,--export-dynamic"]
+
def _link(self, cc, ofiles, link_args, standalone, exe_name):
args = [str(ofile) for ofile in ofiles] + link_args
args += ['-o', str(exe_name)]
@@ -105,6 +111,8 @@
if shared:
linkflags = self._args_for_shared(linkflags)
+ linkflags += self._exportsymbols_link_flags()
+
if shared:
libname = exe_name.new(ext='').basename
target_name = 'lib' + exe_name.new(ext=self.so_ext).basename
diff --git a/rpython/translator/platform/windows.py
b/rpython/translator/platform/windows.py
--- a/rpython/translator/platform/windows.py
+++ b/rpython/translator/platform/windows.py
@@ -271,6 +271,7 @@
linkflags = list(self.link_flags)
if shared:
linkflags = self._args_for_shared(linkflags)
+ linkflags += self._exportsymbols_link_flags()
# Make sure different functions end up at different addresses!
# This is required for the JIT.
linkflags.append('/opt:noicf')
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit