| diff --git a/emcc.py b/emcc.py |
| index bdf788ef2..7eba3e011 100755 |
| --- a/emcc.py |
| +++ b/emcc.py |
| @@ -206,6 +206,9 @@ class EmccOptions(object): |
| # Defaults to using the native EOL on each platform (\r\n on Windows, \n on |
| # Linux & MacOS) |
| self.output_eol = os.linesep |
| + # Whether we will expand the full path of any input files to remove any |
| + # symlinks. |
| + self.expand_symlinks = True |
| |
| |
| def use_source_map(options): |
| @@ -859,7 +862,9 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P |
| '-current_version', '-I', '-L', '-include-pch'): |
| continue # ignore this gcc-style argument |
| |
| - if os.path.islink(arg) and get_file_suffix(os.path.realpath(arg)) in SOURCE_ENDINGS + BITCODE_ENDINGS + DYNAMICLIB_ENDINGS + ASSEMBLY_ENDINGS + HEADER_ENDINGS: |
| + if (options.expand_symlinks |
| + and os.path.islink(arg) |
| + and get_file_suffix(os.path.realpath(arg)) in SOURCE_ENDINGS + BITCODE_ENDINGS + DYNAMICLIB_ENDINGS + ASSEMBLY_ENDINGS + HEADER_ENDINGS): |
| arg = os.path.realpath(arg) |
| |
| if not arg.startswith('-'): |
| @@ -2516,6 +2521,8 @@ def parse_args(newargs): |
| settings_changes.append('SIMD=1') |
| elif newargs[i] == '-mno-simd128': |
| settings_changes.append('SIMD=0') |
| + elif newargs[i] == '-no-canonical-prefixes': |
| + options.expand_symlinks = False |
| |
| if should_exit: |
| sys.exit(0) |
| diff --git a/tools/gen_struct_info.py b/tools/gen_struct_info.py |
| index f6368ecff..7af844a2b 100755 |
| --- a/tools/gen_struct_info.py |
| +++ b/tools/gen_struct_info.py |
| @@ -387,6 +387,14 @@ def inspect_code(headers, cpp_opts, structs, defines): |
| info = [] |
| # Compile the program. |
| show('Compiling generated code...') |
| + cpp_opts += ['-isystem', |
| + shared.path_from_root('system', 'include'), |
| + '-isystem', |
| + shared.path_from_root('system', 'include', 'libcxx'), |
| + '-isystem', |
| + shared.path_from_root('system', 'lib', 'libc', 'musl', 'arch', 'emscripten'), |
| + '-isystem', |
| + shared.path_from_root('system', 'include', 'libc')] |
| # -Oz optimizes enough to avoid warnings on code size/num locals |
| cmd = [shared.PYTHON, shared.EMCC] + cpp_opts + ['-o', js_file[1], src_file[1], '-s', 'BOOTSTRAPPING_STRUCT_INFO=1', '-s', 'WARN_ON_UNDEFINED_SYMBOLS=0', '-O0', '--js-opts', '0', '--memory-init-file', '0', '-s', 'SINGLE_FILE=1', '-s', 'WASM=0', '-Wno-format'] |
| if shared.Settings.WASM_OBJECT_FILES: |
| diff --git a/tools/system_libs.py b/tools/system_libs.py |
| index 61a17d2cf..4de22e706 100755 |
| --- a/tools/system_libs.py |
| +++ b/tools/system_libs.py |
| @@ -91,7 +91,17 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]): |
| |
| return shared.Building.parse_symbols(content).defs |
| |
| - default_opts = ['-Werror'] |
| + default_opts = ['-Werror', |
| + '-isystem', |
| + shared.path_from_root('system', 'include'), |
| + '-isystem', |
| + shared.path_from_root('system', 'include', 'libcxx'), |
| + '-isystem', |
| + shared.path_from_root('system', 'lib', 'libc', 'musl', 'arch', 'emscripten'), |
| + '-isystem', |
| + shared.path_from_root('system', 'include', 'compat'), |
| + '-isystem', |
| + shared.path_from_root('system', 'include', 'libc')] |
| |
| # XXX We also need to add libc symbols that use malloc, for example strdup. It's very rare to use just them and not |
| # a normal malloc symbol (like free, after calling strdup), so we haven't hit this yet, but it is possible. |
| @@ -425,7 +435,7 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]): |
| # al |
| def create_al(libname): # libname is ignored, this is just one .o file |
| o = in_temp('al.o') |
| - check_call([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'al.c'), '-o', o, '-Os'] + get_cflags()) |
| + check_call([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'al.c'), '-o', o, '-Os'] + get_cflags() + default_opts) |
| return o |
| |
| def create_html5(libname): |
| @@ -444,7 +454,7 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]): |
| commands = [] |
| for src in files: |
| o = in_temp(os.path.basename(src) + '.o') |
| - commands.append([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', src), '-O2', '-o', o] + get_cflags()) |
| + commands.append([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', src), '-O2', '-o', o] + get_cflags() + default_opts) |
| o_s.append(o) |
| run_commands(commands) |
| shared.Building.emar('cr', in_temp(libname), o_s) |
| @@ -497,7 +507,7 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]): |
| |
| def create_malloc(out_name): |
| o = in_temp(out_name) |
| - cflags = ['-O2', '-fno-builtin'] |
| + cflags = default_opts + ['-O2', '-fno-builtin'] |
| if shared.Settings.USE_PTHREADS: |
| cflags += ['-s', 'USE_PTHREADS=1'] |
| if shared.Settings.EMSCRIPTEN_TRACING: |