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 15
15
# RUN: not wasm-ld --experimental-pic -shared %t.o -o /dev/null --unresolved-symbols=import-dynamic 2>&1 | \
16
16
# RUN: FileCheck %s
17
17
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
+
18
22
.functype external_func () -> ()
19
23
20
24
use_undefined_function:
@@ -23,7 +27,7 @@ use_undefined_function:
23
27
# CHECK: error: {{.*}}.o: relocation R_WASM_TABLE_INDEX_REL_SLEB is not supported against an undefined symbol `external_func`
24
28
drop
25
29
end_function
26
-
30
+
27
31
use_undefined_data:
28
32
.functype use_undefined_data () -> ()
29
33
i32.const external_data@MBREL
Original file line number Diff line number Diff line change 15
15
# RUN: not wasm-ld -mwasm64 --experimental-pic -shared %t.o -o /dev/null --unresolved-symbols=import-dynamic 2>&1 | \
16
16
# RUN: FileCheck %s
17
17
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
+
18
22
.functype external_func () -> ()
19
23
20
24
use_undefined_function:
@@ -23,7 +27,7 @@ use_undefined_function:
23
27
# CHECK: error: {{.*}}.o: relocation R_WASM_TABLE_INDEX_REL_SLEB64 is not supported against an undefined symbol `external_func`
24
28
drop
25
29
end_function
26
-
30
+
27
31
use_undefined_data:
28
32
.functype use_undefined_data () -> ()
29
33
i64.const external_data@MBREL
Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ void scanRelocations(InputChunk *chunk) {
173
173
}
174
174
}
175
175
176
- if (sym->isUndefined ()) {
176
+ if (!config-> relocatable && sym->isUndefined ()) {
177
177
switch (reloc.Type ) {
178
178
case R_WASM_TABLE_INDEX_REL_SLEB:
179
179
case R_WASM_TABLE_INDEX_REL_SLEB64:
@@ -187,11 +187,11 @@ void scanRelocations(InputChunk *chunk) {
187
187
toString (*sym) + " `" );
188
188
break ;
189
189
}
190
- }
191
190
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
+ }
195
195
}
196
196
}
197
197
}
You can’t perform that action at this time.
0 commit comments