aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-12-19 14:02:34 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-12-19 14:02:34 -0800
commit1c796635aa711764d18a47577d5e94ead309506c (patch)
treedd97efc4a41a618b78d42771de06e1c124baa3f5
parentfca29f7958688e613801f4f13c784796f1270bad (diff)
remove --remove-duplicates
-rwxr-xr-xemcc12
-rwxr-xr-xtests/runner.py24
-rw-r--r--tools/shared.py20
3 files changed, 5 insertions, 51 deletions
diff --git a/emcc b/emcc
index 2190ff1c..7a826b46 100755
--- a/emcc
+++ b/emcc
@@ -322,11 +322,6 @@ Options that are modified or new in %s include:
-v to Clang, and also enable EMCC_DEBUG
to details emcc's operations
- --remove-duplicates If set, will remove duplicate symbols when
- linking. This can be useful because
- llvm-link's behavior is not as permissive
- as ld is.
-
--jcache Use a JavaScript cache. This is disabled by
default. When enabled, emcc will store the
results of compilation in a cache and check
@@ -596,7 +591,6 @@ try:
ignore_dynamic_linking = False
shell_path = shared.path_from_root('src', 'shell.html')
js_libraries = []
- remove_duplicates = False
keep_debug = False
bind = False
jcache = False
@@ -705,7 +699,7 @@ try:
newargs[i] = ''
newargs[i+1] = ''
elif newargs[i] == '--remove-duplicates':
- remove_duplicates = True
+ print >> sys.stderr, 'emcc: warning: --remove-duplicates is deprecated as it is no longer needed. If you cannot link without it, file a bug with a testcase'
newargs[i] = ''
elif newargs[i] == '--jcache':
jcache = True
@@ -912,7 +906,7 @@ try:
# We have a specified target (-o <target>), which is not JavaScript or HTML, and
# we have multiple files: Link them
if DEBUG: print >> sys.stderr, 'emcc: link: ' + str(temp_files), specified_target
- shared.Building.link(temp_files, specified_target, remove_duplicates=remove_duplicates)
+ shared.Building.link(temp_files, specified_target)
exit(0)
## Continue on to create JavaScript
@@ -1027,7 +1021,7 @@ try:
(not LEAVE_INPUTS_RAW and not (suffix(temp_files[0]) in BITCODE_SUFFIXES or suffix(temp_files[0]) in DYNAMICLIB_SUFFIXES) and shared.Building.is_ar(temp_files[0])):
linker_inputs = temp_files + extra_files_to_link
if DEBUG: print >> sys.stderr, 'emcc: linking: ', linker_inputs
- shared.Building.link(linker_inputs, in_temp(target_basename + '.bc'), remove_duplicates=remove_duplicates)
+ shared.Building.link(linker_inputs, in_temp(target_basename + '.bc'))
final = in_temp(target_basename + '.bc')
else:
if not LEAVE_INPUTS_RAW:
diff --git a/tests/runner.py b/tests/runner.py
index 9982d0ef..1ab06164 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -8333,30 +8333,6 @@ f.close()
Popen(['python', EMCC, os.path.join(self.get_dir(), 'foo', 'main.o'), os.path.join(self.get_dir(), 'bar', 'main.o')]).communicate()
self.assertContained('hello there', run_js(os.path.join(self.get_dir(), 'a.out.js')))
- def test_remove_duplicates(self):
- # can happen with .a files. we do a best-effort, removing dupes
- open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write('''
- #include<stdio.h>
- void printey() { printf("bye bye\\n"); }
- int main() {
- printey();
- return 0;
- }
- ''')
- open(os.path.join(self.get_dir(), 'side.cpp'), 'w').write('''
- #include<stdio.h>
- void printey() { printf("bye bye\\n"); }
- ''')
-
- # without --remove-duplicates, we fail
- err = Popen(['python', EMCC, os.path.join(self.get_dir(), 'main.cpp'), os.path.join(self.get_dir(), 'side.cpp')], stderr=PIPE).communicate()[1]
- assert not os.path.exists('a.out.js')
- assert 'multiply' in err
-
- # with it, we succeed
- err = Popen(['python', EMCC, os.path.join(self.get_dir(), 'main.cpp'), os.path.join(self.get_dir(), 'side.cpp'), '--remove-duplicates'], stderr=PIPE).communicate()[1]
- self.assertContained('bye bye', run_js(os.path.join(self.get_dir(), 'a.out.js')))
-
def test_main_a(self):
# if main() is in a .a, we need to pull in that .a
diff --git a/tools/shared.py b/tools/shared.py
index 0a041669..4b63d436 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -712,7 +712,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
Popen([LLVM_EXTRACT, filename, '-delete', '-func=' + symbol, '-o', filename], stderr=PIPE).communicate()
@staticmethod
- def link(files, target, remove_duplicates=False):
+ def link(files, target):
actual_files = []
unresolved_symbols = set(['main']) # tracking unresolveds is necessary for .a linking, see below. (and main is always a necessary symbol)
resolved_symbols = set()
@@ -773,27 +773,11 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
os.chdir(cwd)
try_delete(target)
- if remove_duplicates:
- # Remove duplicate symbols. This is a workaround for how we compile .a files, we try to
- # emulate ld behavior which is permissive TODO: cache llvm-nm results
- seen_symbols = set()
- print >> sys.stderr, actual_files
- for actual in actual_files:
- symbols = Building.llvm_nm(actual)
- dupes = seen_symbols.intersection(symbols.defs)
- if len(dupes) > 0:
- print >> sys.stderr, 'emcc: warning: removing duplicates in', actual
- for dupe in dupes:
- print >> sys.stderr, 'emcc: warning: removing duplicate', dupe
- Building.remove_symbol(actual, dupe)
- Popen([LLVM_EXTRACT, actual, '-delete', '-glob=.str', '-o', actual], stderr=PIPE).communicate() # garbage that appears here
- seen_symbols = seen_symbols.union(symbols.defs)
-
# Finish link
actual_files = list(set(actual_files)) # tolerate people trying to link a.so a.so etc.
if DEBUG: print >>sys.stderr, 'emcc: llvm-linking:', actual_files
output = Popen([LLVM_LINK] + actual_files + ['-o', target], stdout=PIPE).communicate()[0]
- assert os.path.exists(target) and (output is None or 'Could not open input file' not in output), 'Linking error: ' + output + '\nemcc: If you get duplicate symbol errors, try --remove-duplicates'
+ assert os.path.exists(target) and (output is None or 'Could not open input file' not in output), 'Linking error: ' + output
for temp_dir in temp_dirs:
try_delete(temp_dir)