Skip to content

Commit e5901c5

Browse files
committed
Error if GLOBAL_BASE is used with relocatable output
These two options are not compatible, and `GLOBAL_BASE` is currently just ignored in this mode.
1 parent 55934a5 commit e5901c5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

test/test_other.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,10 @@ def test_wl_stackfirst(self):
12731273
err = self.expect_fail(cmd + ['-sGLOBAL_BASE=1024'])
12741274
self.assertContained('error: --stack-first is not compatible with -sGLOBAL_BASE', err)
12751275

1276+
def test_dylink_global_base(self):
1277+
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sGLOBAL_BASE=1024', '-sMAIN_MODULE'])
1278+
self.assertContained('emcc: error: GLOBAL_BASE is not compatible with relocatable output', err);
1279+
12761280
@parameterized({
12771281
# In a simple -O0 build we do not set --low-memory-unused (as the stack is
12781282
# first, which is nice for debugging but bad for code size (larger globals)

tools/link.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,8 @@ def phase_linker_setup(options, state, newargs):
10491049
'__asyncify_data'
10501050
]
10511051

1052+
if 'GLOBAL_BASE' in user_settings:
1053+
exit_with_error('GLOBAL_BASE is not compatible with relocatable output')
10521054
if settings.MINIMAL_RUNTIME:
10531055
exit_with_error('MINIMAL_RUNTIME is not compatible with relocatable output')
10541056
if settings.WASM2JS:

0 commit comments

Comments
 (0)