Bug 1239672 - Fixed symbols file support on mingw. r=glandium

This commit is contained in:
Jacek Caban 2016-01-21 13:39:41 +01:00
parent aa6073b008
commit fd3660e10c
3 changed files with 31 additions and 24 deletions

View File

@ -463,14 +463,19 @@ endif
endif
ifdef SYMBOLS_FILE
ifeq ($(OS_TARGET),WINNT)
ifndef GNU_CC
EXTRA_DSO_LDOPTS += -DEF:$(call normalizepath,$(SYMBOLS_FILE))
else
EXTRA_DSO_LDOPTS += $(call normalizepath,$(SYMBOLS_FILE))
endif
else
ifdef GCC_USE_GNU_LD
EXTRA_DSO_LDOPTS += -Wl,--version-script,$(SYMBOLS_FILE)
else
ifeq ($(OS_TARGET),Darwin)
EXTRA_DSO_LDOPTS += -Wl,-exported_symbols_list,$(SYMBOLS_FILE)
endif
ifeq ($(OS_TARGET),WINNT)
EXTRA_DSO_LDOPTS += -DEF:$(call normalizepath,$(SYMBOLS_FILE))
endif
endif
EXTRA_DEPS += $(SYMBOLS_FILE)

View File

@ -42,24 +42,7 @@ def generate_symbols_file(output, *args):
symbols = [s.strip() for s in pp.out.getvalue().splitlines() if s.strip()]
if buildconfig.substs['GCC_USE_GNU_LD']:
# A linker version script is generated for GNU LD that looks like the
# following:
# {
# global:
# symbol1;
# symbol2;
# ...
# local:
# *;
# };
output.write('{\nglobal:\n %s;\nlocal:\n *;\n};'
% ';\n '.join(symbols))
elif buildconfig.substs['OS_TARGET'] == 'Darwin':
# A list of symbols is generated for Apple ld that simply lists all
# symbols, with an underscore prefix.
output.write(''.join('_%s\n' % s for s in symbols))
elif buildconfig.substs['OS_TARGET'] == 'WINNT':
if buildconfig.substs['OS_TARGET'] == 'WINNT':
# A def file is generated for MSVC link.exe that looks like the
# following:
# LIBRARY library.dll
@ -84,8 +67,25 @@ def generate_symbols_file(output, *args):
# is, in fact, part of the symbol name as far as the symbols variable
# is concerned.
libname, ext = os.path.splitext(os.path.basename(output.name))
assert ext == '.symbols'
assert ext == '.def'
output.write('LIBRARY %s\nEXPORTS\n %s\n'
% (libname, '\n '.join(symbols)))
elif buildconfig.substs['GCC_USE_GNU_LD']:
# A linker version script is generated for GNU LD that looks like the
# following:
# {
# global:
# symbol1;
# symbol2;
# ...
# local:
# *;
# };
output.write('{\nglobal:\n %s;\nlocal:\n *;\n};'
% ';\n '.join(symbols))
elif buildconfig.substs['OS_TARGET'] == 'Darwin':
# A list of symbols is generated for Apple ld that simply lists all
# symbols, with an underscore prefix.
output.write(''.join('_%s\n' % s for s in symbols))
return set(pp.includes)

View File

@ -497,10 +497,12 @@ class SharedLibrary(Library):
else:
self.soname = self.lib_name
if symbols_file:
self.symbols_file = '%s.symbols' % self.lib_name
else:
if not symbols_file:
self.symbols_file = None
elif context.config.substs['OS_TARGET'] == 'WINNT':
self.symbols_file = '%s.def' % self.lib_name
else:
self.symbols_file = '%s.symbols' % self.lib_name
class ExternalLibrary(object):