diff --git a/emcc.py b/emcc.py index d78335245b6a4..7339957d17261 100644 --- a/emcc.py +++ b/emcc.py @@ -250,10 +250,6 @@ def run(args): print(f'libraries: ={cache.get_lib_dir(absolute=True)}') return 0 - if '-print-resource-dir' in args: - shared.check_call([clang] + args) - return 0 - if '-print-libgcc-file-name' in args or '--print-libgcc-file-name' in args: settings.limit_settings(None) compiler_rt = system_libs.Library.get_usable_variations()['libcompiler_rt'] @@ -292,6 +288,10 @@ def run(args): phase_setup(options, state) + if '-print-resource-dir' in args or any(a.startswith('--print-prog-name') for a in args): + shared.exec_process([clang] + compile.get_cflags(tuple(args)) + args) + assert False, 'exec_process should not return' + if '--cflags' in args: # Just print the flags we pass to clang and exit. We need to do this after # phase_setup because the setup sets things like SUPPORT_LONGJMP. @@ -513,7 +513,7 @@ def get_clang_command_asm(): else: cmd = get_clang_command() + newargs shared.exec_process(cmd) - assert False, 'exec_process does not return' + assert False, 'exec_process should not return' # In COMPILE_AND_LINK we need to compile source files too, but we also need to # filter out the link flags diff --git a/test/test_other.py b/test/test_other.py index 1be01a6589a84..716da4e8ef081 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -751,6 +751,14 @@ def test_print_resource_dir(self): llvm_root = os.path.normcase(os.path.dirname(config.LLVM_ROOT)) self.assertContained(llvm_root, resource_dir) + @crossplatform + def test_print_prog_name(self): + output = self.run_process([EMCC, '--print-prog-name=clang'], stdout=PIPE).stdout + expected = CLANG_CC + if WINDOWS: + expected = os.path.normpath(shared.unsuffixed(CLANG_CC)) + self.assertContained(expected, output) + @crossplatform @parameterized({ '': [[]],