diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-16 19:08:30 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-16 19:08:30 -0800 |
commit | 7ae17d41b81474e2a7dce3281195bb5c9c5e7bb2 (patch) | |
tree | 507ad89a424eadd6e407b43a74d8880dc9212147 /emcc | |
parent | d157b2049d07d3396cfa6d646d56705100ef412f (diff) |
improve linking in emcc, can now build zlib, openjpeg, freetype
Diffstat (limited to 'emcc')
-rwxr-xr-x | emcc | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -342,11 +342,9 @@ try: if DEBUG: print >> sys.stderr, 'emcc: compiling to bitcode' # First, generate LLVM bitcode. For each input file, we get base.o with bitcode - newargs = newargs + ['-emit-llvm', '-c'] - for input_file in input_files: if input_file.endswith(SOURCE_SUFFIXES): - args = newargs + [input_file, '-o', in_temp(unsuffixed_basename(input_file) + '.o')] + args = newargs + ['-emit-llvm', '-c', input_file, '-o', in_temp(unsuffixed_basename(input_file) + '.o')] if DEBUG: print >> sys.stderr, "emcc running:", call, ' '.join(args) Popen([call] + args).communicate() else: # bitcode @@ -372,9 +370,12 @@ try: else: assert not has_dash_c, 'fatal error: cannot specify -o with -c with multiple files' + str(sys.argv) # We have a specified target (-o <target>), which is not JavaScript or HTML, and - # we have multiple files: Link them. TODO: Pass complex linker args along - shared.Building.link(map(lambda input_file: in_temp(unsuffixed_basename(input_file) + '.o'), input_files), specified_target) - + # we have multiple files: Link them TODO: llvm link-time opts? + ld_args = map(lambda input_file: in_temp(unsuffixed_basename(input_file) + '.o'), input_files) + \ + ['-o', specified_target] + #[arg.split('-Wl,')[1] for arg in filter(lambda arg: arg.startswith('-Wl,'), sys.argv)] + if DEBUG: print >> sys.stderr, 'emcc: link: ' + str(ld_args) + Popen([shared.LLVM_LINK] + ld_args).communicate() exit(0) ## Continue on to create JavaScript @@ -416,7 +417,7 @@ try: if len(input_files) + len(extra_files_to_link) > 1: shared.Building.link(map(lambda input_file: in_temp(unsuffixed_basename(input_file) + '.o'), input_files) + extra_files_to_link, in_temp(target_basename + '.bc')) - # TODO: LLVM link-time opts? + # TODO: LLVM link-time opts? here and/or elsewhere? else: shutil.move(in_temp(unsuffixed_basename(input_files[0]) + '.o'), in_temp(target_basename + '.bc')) |