File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 1515# RUN: not wasm-ld --experimental-pic -shared %t.o -o /dev/null --unresolved-symbols=import-dynamic 2>&1 | \
1616# RUN: FileCheck %s
1717
18+ ## These errors should not be reported under -r/--relocation (i.e. when
19+ ## generating an object file)
20+ # RUN: wasm-ld --experimental-pic -r %t.o -o /dev/null
21+
1822.functype external_func () -> ()
1923
2024use_undefined_function:
@@ -23,7 +27,7 @@ use_undefined_function:
2327 # CHECK: error: {{.*}}.o: relocation R_WASM_TABLE_INDEX_REL_SLEB is not supported against an undefined symbol `external_func`
2428 drop
2529 end_function
26-
30+
2731use_undefined_data:
2832 .functype use_undefined_data () -> ()
2933 i32.const external_data@MBREL
Original file line number Diff line number Diff line change 1515# RUN: not wasm-ld -mwasm64 --experimental-pic -shared %t.o -o /dev/null --unresolved-symbols=import-dynamic 2>&1 | \
1616# RUN: FileCheck %s
1717
18+ ## These errors should not be reported under -r/--relocation (i.e. when
19+ ## generating an object file)
20+ # RUN: wasm-ld -mwasm64 --experimental-pic -r %t.o -o /dev/null
21+
1822.functype external_func () -> ()
1923
2024use_undefined_function:
@@ -23,7 +27,7 @@ use_undefined_function:
2327 # CHECK: error: {{.*}}.o: relocation R_WASM_TABLE_INDEX_REL_SLEB64 is not supported against an undefined symbol `external_func`
2428 drop
2529 end_function
26-
30+
2731use_undefined_data:
2832 .functype use_undefined_data () -> ()
2933 i64.const external_data@MBREL
Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ void scanRelocations(InputChunk *chunk) {
173173 }
174174 }
175175
176- if (sym->isUndefined ()) {
176+ if (!config-> relocatable && sym->isUndefined ()) {
177177 switch (reloc.Type ) {
178178 case R_WASM_TABLE_INDEX_REL_SLEB:
179179 case R_WASM_TABLE_INDEX_REL_SLEB64:
@@ -187,11 +187,11 @@ void scanRelocations(InputChunk *chunk) {
187187 toString (*sym) + " `" );
188188 break ;
189189 }
190- }
191190
192- if (sym->isUndefined () && !config->relocatable && !sym->isWeak ()) {
193- // Report undefined symbols
194- reportUndefined (file, sym);
191+ if (!sym->isWeak ()) {
192+ // Report undefined symbols
193+ reportUndefined (file, sym);
194+ }
195195 }
196196 }
197197}
You can’t perform that action at this time.
0 commit comments