Skip to content

Commit 6e82a51

Browse files
authored
Remove support for --default-obj-ext (#20917)
As far as I can tell the only user of this option was add mostly in support for custom cmake and visual studio integration that was removed in #20901. This feature is something that neither clang nor gcc and I'd like to remove it so that we can move closer to being a pure clang wrapper.
1 parent 6eaf422 commit 6e82a51

File tree

5 files changed

+4
-64
lines changed

5 files changed

+4
-64
lines changed

ChangeLog.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ See docs/process.md for more on how version tagging works.
2020

2121
3.1.51 (in development)
2222
-----------------------
23+
- The `--default-obj-ext` command line flag was removed. (#20917)
2324
- Support for explicitly targeting the legacy Interet Explorer or EdgeHTML
2425
(edge version prior to the chromium-based edge) browsers via
2526
`-sMIN_EDGE_VERSION/-sMIN_IE_VERSION` was removed. (#20881)

docs/emcc.txt

-7
Original file line numberDiff line numberDiff line change
@@ -569,13 +569,6 @@ Options that are modified or new in *emcc* are listed below:
569569
the user's home directory ("~/.emscripten"). This can be overridden
570570
using the "EM_CONFIG" environment variable.
571571

572-
"--default-obj-ext <.ext>"
573-
[compile] Specifies the output suffix to use when compiling with
574-
"-c" in the absence of "-o". For example, when compiling multiple
575-
sources files with "emcc -c *.c" the compiler will normally output
576-
files with the ".o" extension, but "--default-obj-ext .obj" can be
577-
used to instead generate files with the *.obj* extension.
578-
579572
"--valid-abspath <path>"
580573
[compile+link] Note an allowed absolute path, which we should not
581574
warn about (absolute include paths normally are warned about, since

emcc.py

+3-38
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import os
2828
import re
2929
import shlex
30-
import shutil
3130
import sys
3231
import time
3332
import tarfile
@@ -78,7 +77,6 @@
7877

7978
SIMD_INTEL_FEATURE_TOWER = ['-msse', '-msse2', '-msse3', '-mssse3', '-msse4.1', '-msse4.2', '-msse4', '-mavx']
8079
SIMD_NEON_FLAGS = ['-mfpu=neon']
81-
COMPILE_ONLY_FLAGS = {'--default-obj-ext'}
8280
LINK_ONLY_FLAGS = {
8381
'--bind', '--closure', '--cpuprofiler', '--embed-file',
8482
'--emit-symbol-map', '--emrun', '--exclude-file', '--extern-post-js',
@@ -149,7 +147,6 @@ def __init__(self):
149147
self.memory_init_file = None
150148
self.use_preload_cache = False
151149
self.use_preload_plugins = False
152-
self.default_object_extension = '.o'
153150
self.valid_abspaths = []
154151
# Specifies the line ending format to use for all generated text files.
155152
# Defaults to using the native EOL on each platform (\r\n on Windows, \n on
@@ -811,23 +808,6 @@ def phase_setup(options, state, newargs):
811808
diagnostics.warning(
812809
'unused-command-line-argument',
813810
"linker flag ignored during compilation: '%s'" % arg)
814-
if state.has_dash_c:
815-
if '-emit-llvm' in newargs:
816-
options.default_object_extension = '.bc'
817-
elif state.has_dash_S:
818-
if '-emit-llvm' in newargs:
819-
options.default_object_extension = '.ll'
820-
else:
821-
options.default_object_extension = '.s'
822-
elif '-M' in newargs or '-MM' in newargs:
823-
options.default_object_extension = '.mout' # not bitcode, not js; but just dependency rule of the input file
824-
825-
else:
826-
for arg in state.orig_args:
827-
if any(arg.startswith(f) for f in COMPILE_ONLY_FLAGS):
828-
diagnostics.warning(
829-
'unused-command-line-argument',
830-
"compiler flag ignored during linking: '%s'" % arg)
831811

832812
if settings.MAIN_MODULE or settings.SIDE_MODULE:
833813
settings.RELOCATABLE = 1
@@ -1006,20 +986,7 @@ def get_clang_command_asm():
1006986
cmd += ['-o', options.output_file]
1007987
if get_file_suffix(options.output_file) == '.bc' and not settings.LTO and '-emit-llvm' not in state.orig_args:
1008988
diagnostics.warning('emcc', '.bc output file suffix used without -flto or -emit-llvm. Consider using .o extension since emcc will output an object file, not a bitcode file')
1009-
ext = get_clang_output_extension(state)
1010-
if not options.output_file and options.default_object_extension != ext:
1011-
# If we are using a non-standard output file extention we cannot use
1012-
# exec_process here since we need to rename the files
1013-
# after clang runs (since clang does not support --default-obj-ext)
1014-
# TODO: Remove '--default-obj-ext' to reduce this complexity
1015-
shared.check_call(cmd)
1016-
for i in inputs:
1017-
output = unsuffixed_basename(i) + ext
1018-
new_output = unsuffixed_basename(i) + options.default_object_extension
1019-
shutil.move(output, new_output)
1020-
sys.exit(0)
1021-
else:
1022-
shared.exec_process(cmd)
989+
shared.exec_process(cmd)
1023990

1024991
# In COMPILE_AND_LINK we need to compile source files too, but we also need to
1025992
# filter out the link flags
@@ -1039,7 +1006,7 @@ def uniquename(name):
10391006
return unsuffixed(name) + '_' + seen_names[name] + shared.suffix(name)
10401007

10411008
def get_object_filename(input_file):
1042-
return in_temp(unsuffixed(uniquename(input_file)) + options.default_object_extension)
1009+
return in_temp(shared.replace_suffix(uniquename(input_file), '.o'))
10431010

10441011
def compile_source_file(i, input_file):
10451012
logger.debug(f'compiling source file: {input_file}')
@@ -1384,9 +1351,7 @@ def consume_arg_file():
13841351
elif arg == '-fignore-exceptions':
13851352
settings.DISABLE_EXCEPTION_CATCHING = 1
13861353
elif check_arg('--default-obj-ext'):
1387-
options.default_object_extension = consume_arg()
1388-
if not options.default_object_extension.startswith('.'):
1389-
options.default_object_extension = '.' + options.default_object_extension
1354+
exit_with_error('--default-obj-ext is no longer supported by emcc')
13901355
elif arg.startswith('-fsanitize=cfi'):
13911356
exit_with_error('emscripten does not currently support -fsanitize=cfi')
13921357
elif check_arg('--output_eol'):

site/source/docs/tools_reference/emcc.rst

-8
Original file line numberDiff line numberDiff line change
@@ -528,14 +528,6 @@ Options that are modified or new in *emcc* are listed below:
528528
directory itself, and then in the user's home directory (``~/.emscripten``).
529529
This can be overridden using the ``EM_CONFIG`` environment variable.
530530

531-
``--default-obj-ext <.ext>``
532-
[compile]
533-
Specifies the output suffix to use when compiling with ``-c`` in the absence
534-
of ``-o``. For example, when compiling multiple sources files with ``emcc -c
535-
*.c`` the compiler will normally output files with the ``.o`` extension, but
536-
``--default-obj-ext .obj`` can be used to instead generate files with the
537-
`.obj` extension.
538-
539531
``--valid-abspath <path>``
540532
[compile+link]
541533
Note an allowed absolute path, which we should not warn about (absolute

test/test_other.py

-11
Original file line numberDiff line numberDiff line change
@@ -4188,13 +4188,6 @@ def test_output_is_dir(self):
41884188
err = self.expect_fail([EMCC, '-c', test_file('hello_world.c'), '-o', 'out_dir/'])
41894189
self.assertContained('error: unable to open output file', err)
41904190

4191-
def test_default_obj_ext(self):
4192-
self.run_process([EMCC, '-c', test_file('hello_world.c')])
4193-
self.assertExists('hello_world.o')
4194-
4195-
self.run_process([EMCC, '-c', test_file('hello_world.c'), '--default-obj-ext', 'obj'])
4196-
self.assertExists('hello_world.obj')
4197-
41984191
def test_doublestart_bug(self):
41994192
create_file('code.c', r'''
42004193
#include <stdio.h>
@@ -12585,10 +12578,6 @@ def test_link_only_flag_warning(self):
1258512578
err = self.run_process([EMCC, '--embed-file', 'file', '-c', test_file('hello_world.c')], stderr=PIPE).stderr
1258612579
self.assertContained("warning: linker flag ignored during compilation: '--embed-file' [-Wunused-command-line-argument]", err)
1258712580

12588-
def test_compile_only_flag_warning(self):
12589-
err = self.run_process([EMCC, '--default-obj-ext', 'foo', test_file('hello_world.c')], stderr=PIPE).stderr
12590-
self.assertContained("warning: compiler flag ignored during linking: '--default-obj-ext' [-Wunused-command-line-argument]", err)
12591-
1259212581
def test_no_deprecated(self):
1259312582
# Test that -Wno-deprecated is passed on to clang driver
1259412583
create_file('test.c', '''\

0 commit comments

Comments
 (0)