[PATCH] D64148: [lld][WebAssembly] Fix __start/__stop symbols when combining input segments

Carlo Kok via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 4 01:47:13 PDT 2019


carlokok added a comment.

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
lld -flavor wasm lltset.o -o lltest.wasm -no-entry --export-dynamic --undefined=test

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                            end

Despite 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'


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64148/new/

https://reviews.llvm.org/D64148





More information about the llvm-commits mailing list