brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 7b82f8b Raw
67 lines · plain
1# RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj < %s | llvm-readobj --symbols - | FileCheck %s2 3# Regression test for wasm support of the ELF symbol-versioning directive4# `.symver`. wasm (the object format) has no symbol versioning, but glibc's5# shared build emits `.symver` pervasively via inline/module asm, e.g.6#   .symver __SI__libc_start_main_alias_2_1, __libc_start_main@@GLIBC_2.347# The wasm asm parser used to reject these with "unknown directive". They are8# now mapped onto the assembler-alias machinery (HWJS-B-1):9#10#  - A default version (`name@@VER`) makes the bare `name` a public alias of11#    the base symbol, dropping the version tag: `name` resolves to the base at12#    link, exactly like `.set name, base` + `.globl name`.13#  - A non-default / compat version (`name@VER`, single `@`) is a compat symbol14#    for OLD binaries, which do not exist on this fresh ABI. It is dropped so it15#    cannot create a second, colliding public `name`. Its base symbol is left16#    untouched.17 18default_base:19  .functype default_base () -> ()20  end_function21.globl default_base22.hidden default_base23 24compat_base:25  .functype compat_base () -> ()26  end_function27.globl compat_base28.hidden compat_base29 30# Default (@@) version: the bare name becomes a public alias of default_base.31.symver default_base, __libc_start_main@@VERS_232 33# Non-default (@) compat version: dropped. It must NOT create a second public34# __libc_start_main colliding with the default alias above.35.symver compat_base, __libc_start_main@VERS_136 37# The two base functions are present and hidden. Exactly ONE public38# __libc_start_main is emitted, aliasing the *default* base (ElementIndex 0x0 ==39# default_base), never the compat base (ElementIndex 0x1). The closing "]"40# CHECK-NEXT asserts no extra (colliding) __libc_start_main symbol leaks in.41 42# CHECK:      Symbols [43# CHECK-NEXT:   Symbol {44# CHECK-NEXT:     Name: default_base45# CHECK-NEXT:     Type: FUNCTION (0x0)46# CHECK-NEXT:     Flags [ (0x4)47# CHECK-NEXT:       VISIBILITY_HIDDEN (0x4)48# CHECK-NEXT:     ]49# CHECK-NEXT:     ElementIndex: 0x050# CHECK-NEXT:   }51# CHECK-NEXT:   Symbol {52# CHECK-NEXT:     Name: compat_base53# CHECK-NEXT:     Type: FUNCTION (0x0)54# CHECK-NEXT:     Flags [ (0x4)55# CHECK-NEXT:       VISIBILITY_HIDDEN (0x4)56# CHECK-NEXT:     ]57# CHECK-NEXT:     ElementIndex: 0x158# CHECK-NEXT:   }59# CHECK-NEXT:   Symbol {60# CHECK-NEXT:     Name: __libc_start_main61# CHECK-NEXT:     Type: FUNCTION (0x0)62# CHECK-NEXT:     Flags [ (0x0)63# CHECK-NEXT:     ]64# CHECK-NEXT:     ElementIndex: 0x065# CHECK-NEXT:   }66# CHECK-NEXT: ]67