When calculating the symbol offsets to write as provisitonal values in object files we are only interested in the offset of the symbol itself. For aliases this offset already includes the offset of the base symbol. The testin question was added back in https://reviews.llvm.org/D87407 but I believe the expectations here were incorrect. sym_a lives at offset 4 and sym_b lives 4 bytes into that (should be 8). The addresses of the 3 symbosl in this object file are: foo : 0 sym_a: 4 sym_b: 8 Differential Revision: https://reviews.llvm.org/D96234
35 lines
951 B
ArmAsm
35 lines
951 B
ArmAsm
# RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj %s | llvm-objdump --triple=wasm32-unknown-unknown -d -t -r - | FileCheck %s
|
|
|
|
.section .data,"",@
|
|
foo:
|
|
.int32 0
|
|
.size foo, 4
|
|
sym_a:
|
|
.int32 1
|
|
.int32 2
|
|
.size sym_a, 8
|
|
|
|
.set sym_b, sym_a + 4
|
|
|
|
# CHECK-LABEL: SYMBOL TABLE:
|
|
# CHECK-NEXT: 00000000 l O DATA foo
|
|
# CHECK-NEXT: 00000004 l O DATA sym_a
|
|
# CHECK-NEXT: 00000008 l O DATA sym_b
|
|
# CHECK-NEXT: 00000001 l F CODE main
|
|
|
|
.text
|
|
.section .text,"",@
|
|
main:
|
|
.functype main () -> ()
|
|
i32.const sym_a
|
|
i32.store sym_b
|
|
end_function
|
|
|
|
# CHECK-LABEL: <main>:
|
|
# CHECK-EMPTY:
|
|
# CHECK-NEXT: 3: 41 84 80 80 80 00 i32.const 4
|
|
# CHECK-NEXT: 00000004: R_WASM_MEMORY_ADDR_SLEB sym_a+0
|
|
# CHECK-NEXT: 9: 36 02 88 80 80 80 00 i32.store 8
|
|
# CHECK-NEXT: 0000000b: R_WASM_MEMORY_ADDR_LEB sym_b+0
|
|
# CHECK-NEXT: 10: 0b end
|