mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[AsmPrinter][ELF] Emit local alias for ExternalLinkage dso_local GlobalAlias
This commit is contained in:
parent
3f8a544115
commit
a9c1f8f10e
@ -460,7 +460,7 @@ MCSymbol *AsmPrinter::getSymbolPreferLocal(const GlobalValue &GV) const {
|
||||
// assumed it.
|
||||
if (TM.getTargetTriple().isOSBinFormatELF() &&
|
||||
GlobalObject::isExternalLinkage(GV.getLinkage()) && GV.isDSOLocal() &&
|
||||
!GV.isDeclaration() && isa<GlobalObject>(GV))
|
||||
!GV.isDeclaration() && !isa<GlobalIFunc>(GV))
|
||||
return getSymbolWithGlobalValueBase(&GV, "$local");
|
||||
return TM.getSymbol(&GV);
|
||||
}
|
||||
@ -1383,6 +1383,9 @@ void AsmPrinter::emitGlobalIndirectSymbol(Module &M,
|
||||
|
||||
// Emit the directives as assignments aka .set:
|
||||
OutStreamer->EmitAssignment(Name, Expr);
|
||||
MCSymbol *LocalAlias = getSymbolPreferLocal(GIS);
|
||||
if (LocalAlias != Name)
|
||||
OutStreamer->EmitAssignment(LocalAlias, Expr);
|
||||
|
||||
if (auto *GA = dyn_cast<GlobalAlias>(&GIS)) {
|
||||
// If the aliasee does not correspond to a symbol in the output, i.e. the
|
||||
|
@ -12,7 +12,7 @@ target triple = "i386-pc-linux-gnu"
|
||||
|
||||
define i32 @foo() {
|
||||
; CHECK-LABEL: foo:
|
||||
; CHECK: leal __libc_resp@TLSLD
|
||||
; CHECK: leal .L__libc_resp$local@TLSLDM
|
||||
entry:
|
||||
%retval = alloca i32 ; <i32*> [#uses=1]
|
||||
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
|
||||
@ -27,7 +27,7 @@ return: ; preds = %entry
|
||||
|
||||
define i32 @bar() {
|
||||
; CHECK-LABEL: bar:
|
||||
; CHECK: leal __libc_resp@TLSLD
|
||||
; CHECK: leal .L__libc_resp$local@TLSLDM
|
||||
entry:
|
||||
%retval = alloca i32 ; <i32*> [#uses=1]
|
||||
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
|
||||
|
@ -108,9 +108,9 @@ define i32* @get_weak_default_alias() {
|
||||
define i32* @get_strong_local_alias() {
|
||||
ret i32* @strong_local_alias
|
||||
}
|
||||
; CHECK: leaq strong_local_alias(%rip), %rax
|
||||
; STATIC: movl $strong_local_alias, %eax
|
||||
; CHECK32: leal strong_local_alias@GOTOFF(%eax), %eax
|
||||
; CHECK: leaq .Lstrong_local_alias$local(%rip), %rax
|
||||
; STATIC: movl $.Lstrong_local_alias$local, %eax
|
||||
; CHECK32: leal .Lstrong_local_alias$local@GOTOFF(%eax), %eax
|
||||
|
||||
@weak_local_alias = weak dso_local alias i32, i32* @aliasee
|
||||
define i32* @get_weak_local_alias() {
|
||||
@ -235,6 +235,7 @@ define void()* @get_external_preemptable_function() {
|
||||
; COMMON-NEXT: .set weak_default_alias, aliasee
|
||||
; COMMON-NEXT: .globl strong_local_alias
|
||||
; COMMON-NEXT: .set strong_local_alias, aliasee
|
||||
; COMMON-NEXT: .set .Lstrong_local_alias$local, aliasee
|
||||
; COMMON-NEXT: .weak weak_local_alias
|
||||
; COMMON-NEXT: .set weak_local_alias, aliasee
|
||||
; COMMON-NEXT: .globl strong_preemptable_alias
|
||||
|
Loading…
Reference in New Issue
Block a user