1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/MC/ELF/symver-remove.s
Fangrui Song 7517775e7d [MC] Support .symver *, *, remove
As a resolution to https://sourceware.org/bugzilla/show_bug.cgi?id=25295 , GNU as
from binutils 2.35 supports the optional third argument for the .symver directive.

'remove' for a non-default version is useful:
`.symver def_v1, def@v1, remove` => def_v1 is not retained in the symbol table.
Previously the user has to strip the original symbol or specify a `local:`
version node in a version script to localize the symbol.

`.symver def, def@@v1, remove` and `.symver def, def@@@v1, remove` are supported
as well, though they are identical to `.symver def, def@@@v1`.

local/hidden are not useful so this patch does not implement them.
2021-03-06 15:23:02 -08:00

37 lines
1.1 KiB
ArmAsm

# RUN: llvm-mc -triple=x86_64 %s | FileCheck %s --check-prefix=ASM
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t
# RUN: llvm-readelf -s %t | FileCheck %s
# ASM: .symver nondef, nondef@v1, remove
# ASM-NEXT: nondef:
# ASM: .symver def0, def0@@v2, remove
# ASM-NEXT: .symver def1, def1@@@v2{{$}}
# ASM-NEXT: def0:
# ASM-NEXT: def1:
# ASM: .symver def2, def2@v1, remove
# ASM-NEXT: .symver def2, def2@@v2{{$}}
# ASM-NEXT: def2:
# CHECK: 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT [[#]] nondef@v1
# CHECK-NEXT: 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT [[#]] def0@@v2
# CHECK-NEXT: 3: 0000000000000000 0 NOTYPE GLOBAL DEFAULT [[#]] def1@@v2
# CHECK-NEXT: 4: 0000000000000000 0 NOTYPE GLOBAL DEFAULT [[#]] def2@v1
# CHECK-NEXT: 5: 0000000000000000 0 NOTYPE GLOBAL DEFAULT [[#]] def2@@v2
# CHECK-NOT: {{.}}
.globl nondef
.symver nondef, nondef@v1, remove
nondef:
.globl def0, def1, def2
.symver def0, def0@@v2, remove
.symver def1, def1@@@v2, remove
def0:
def1:
## Giving multiple versions to the same original symbol is not useful.
## This test just documents the behavior.
.symver def2, def2@v1, remove
.symver def2, def2@@v2
def2: