summaryrefslogtreecommitdiff
path: root/methods.py
diff options
context:
space:
mode:
Diffstat (limited to 'methods.py')
-rw-r--r--methods.py26
1 files changed, 19 insertions, 7 deletions
diff --git a/methods.py b/methods.py
index 86ab7cd9af..84074db0eb 100644
--- a/methods.py
+++ b/methods.py
@@ -307,7 +307,7 @@ def split_lib(self, libname, src_list = None, env_lib = None):
else:
fname = env.File(f)[0].path
fname = fname.replace("\\", "/")
- base = string.join(fname.split("/")[:2], "/")
+ base = "/".join(fname.split("/")[:2])
if base != cur_base and len(list) > max_src:
if num > 0:
lib = env_lib.add_library(libname + str(num), list)
@@ -320,12 +320,6 @@ def split_lib(self, libname, src_list = None, env_lib = None):
lib = env_lib.add_library(libname + str(num), list)
lib_list.append(lib)
- if len(lib_list) > 0:
- if os.name == 'posix' and sys.platform == 'msys':
- env.Replace(ARFLAGS=['rcsT'])
- lib = env_lib.add_library(libname + "_collated", lib_list)
- lib_list = [lib]
-
lib_base = []
env_lib.add_source_files(lib_base, "*.cpp")
lib = env_lib.add_library(libname, lib_base)
@@ -333,6 +327,24 @@ def split_lib(self, libname, src_list = None, env_lib = None):
env.Prepend(LIBS=lib_list)
+ # When we split modules into arbitrary chunks, we end up with linking issues
+ # due to symbol dependencies split over several libs, which may not be linked
+ # in the required order. We use --start-group and --end-group to tell the
+ # linker that those archives should be searched repeatedly to resolve all
+ # undefined references.
+ # As SCons doesn't give us much control over how inserting libs in LIBS
+ # impacts the linker call, we need to hack our way into the linking commands
+ # LINKCOM and SHLINKCOM to set those flags.
+
+ if '-Wl,--start-group' in env['LINKCOM'] and '-Wl,--start-group' in env['SHLINKCOM']:
+ # Already added by a previous call, skip.
+ return
+
+ env['LINKCOM'] = str(env['LINKCOM']).replace('$_LIBFLAGS',
+ '-Wl,--start-group $_LIBFLAGS -Wl,--end-group')
+ env['SHLINKCOM'] = str(env['LINKCOM']).replace('$_LIBFLAGS',
+ '-Wl,--start-group $_LIBFLAGS -Wl,--end-group')
+
def save_active_platforms(apnames, ap):