mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 07:01:03 +08:00
[MC] Change ELFOSABI_NONE to ELFOSABI_GNU for STB_GNU_UNIQUE
Similar to D97976. On Linux, most GCC installations are configured with `--enable-gnu-unique-object` and such GCC emits `@gnu_unique_object` assembly. The feature is highly controversial and disliked by many folks. (On glibc DF_1_NODELETE is implicitly enabled and makes dlclose a no-op). In llvm-project STB_GNU_UNIQUE is assembly only. Clang does not use STB_GNU_UNIQUE. Use ELFOSABI_GNU to match GNU as behavior and avoid collision with other OSABI binding values. Reviewed By: jrtc27 Differential Revision: https://reviews.llvm.org/D107861
This commit is contained in:
@@ -224,6 +224,7 @@ bool MCELFStreamer::emitSymbolAttribute(MCSymbol *S, MCSymbolAttr Attribute) {
|
||||
case MCSA_ELF_TypeGnuUniqueObject:
|
||||
Symbol->setType(CombineSymbolTypes(Symbol->getType(), ELF::STT_OBJECT));
|
||||
Symbol->setBinding(ELF::STB_GNU_UNIQUE);
|
||||
getAssembler().getWriter().markGnuAbi();
|
||||
break;
|
||||
|
||||
case MCSA_Global:
|
||||
|
||||
@@ -29,10 +29,3 @@
|
||||
|
||||
.type string_type, "function"
|
||||
// CHECK: .type string_type,@function
|
||||
|
||||
.type special gnu_unique_object
|
||||
// CHECK: .type special,@gnu_unique_object
|
||||
|
||||
.type comma_special, gnu_unique_object
|
||||
// CHECK: .type comma_special,@gnu_unique_object
|
||||
|
||||
|
||||
13
llvm/test/MC/ELF/gnu-unique.s
Normal file
13
llvm/test/MC/ELF/gnu-unique.s
Normal file
@@ -0,0 +1,13 @@
|
||||
# RUN: llvm-mc -triple=x86_64 %s | FileCheck %s --check-prefix=ASM
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s | llvm-readelf -h -s - | FileCheck %s --check-prefix=OBJ
|
||||
|
||||
# ASM: .type unique,@gnu_unique_object
|
||||
|
||||
# OBJ: OS/ABI: UNIX - GNU
|
||||
# OBJ: Type Bind Vis Ndx Name
|
||||
# OBJ: OBJECT UNIQUE DEFAULT [[#]] unique
|
||||
|
||||
.data
|
||||
.globl unique
|
||||
.type unique, @gnu_unique_object
|
||||
unique:
|
||||
Reference in New Issue
Block a user