We should be generating one __start/__stop pair per output segment
not per input segment. The test wasn't catching this because it was
only linking a single object file.
Fixes PR41565
Differential D64148
[lld][WebAssembly] Fix __start/__stop symbols when combining input segments Authored by sbc100 on Jul 3 2019, 10:38 AM.
Details We should be generating one __start/__stop pair per output segment Fixes PR41565
Diff Detail
Event TimelineComment Actions With this patch, the symbols still seem to end up as 0: target triple = "wasm32"
@__start_ELRTMLRR = external global i32
@__stop_ELRTMLRR = external global i32
@"ms_t7__1sTypee_GetMethodStart$MD" = constant { [16 x i8], i32* ()* } { [16 x i8] c"\CA\F0\D0\A07\CEi\B1\0F\BEkAqI\ED\BA", i32* ()* @ms_t7__1sTypee_GetMethodStart }, section "ELRTMLRR"
@"ms_t7__1sTyped_GetMethodsEnd$MD" = constant { [16 x i8], i32* ()* } { [16 x i8] c"\0E\BFR\1EJ+G\D7\F8B\96\9B3\E1\8D%", i32* ()* @ms_t7__1sTyped_GetMethodsEnd }, section "ELRTMLRR"
@"both" = constant { { [16 x i8], i32* ()* }*, { [16 x i8], i32* ()* }* } {{ [16 x i8], i32* ()* }*@"ms_t7__1sTypee_GetMethodStart$MD", { [16 x i8], i32* ()* }*@"ms_t7__1sTyped_GetMethodsEnd$MD"}
define nonnull i32* @ms_t7__1sTypee_GetMethodStart() {
BasicBlock229:
ret i32* @__start_ELRTMLRR
}
define nonnull i32* @ms_t7__1sTyped_GetMethodsEnd() {
BasicBlock232:
ret i32* @__stop_ELRTMLRR
}
define nonnull i32* @test() {
%abba = load { { [16 x i8], i32* ()* }*, { [16 x i8], i32* ()* }* }, { { [16 x i8], i32* ()* }*, { [16 x i8], i32* ()* }* }* @"both"
ret i32* null
}llc -filetype=obj lltset.ll C:\p\llvm\llvm-bin64\Debug\bin>llvm-objdump.exe lltest.wasm --disassemble lltest.wasm: file format WASM Disassembly of section CODE:
00000000 CODE:
# 3 functions in section.
1: 08 00 throw 0
3: 41 80 80 80 80 00 i32.const 0
9: 0b end
a: 08 00 throw 0
c: 41 80 80 80 80 00 i32.const 0
12: 0b end
13: 04 00 if invalid_type
15: 41 00 i32.const 0
17: 0b endDespite it being present at offset 1024: - Type: DATA
Segments:
- SectionOffset: 7
InitFlags: 0
Offset:
Opcode: I32_CONST
Value: 1024
Content: CAF0D0A037CE69B10FBE6B417149EDBA010000000000000000000000000000000EBF521E4A2B47D7F842969B33E18D2502000000
- SectionOffset: 65
InitFlags: 0
Offset:
Opcode: I32_CONST
Value: 1080
Content: '0004000020040000' |