mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-01 01:30:36 +00:00
Keep unnamed_addr when linking.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123364 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d72479c2f0
commit
c2a94da313
@ -352,6 +352,8 @@ static void CopyGVAttributes(GlobalValue *DestGV, const GlobalValue *SrcGV) {
|
||||
unsigned Alignment = std::max(DestGV->getAlignment(), SrcGV->getAlignment());
|
||||
DestGV->copyAttributesFrom(SrcGV);
|
||||
DestGV->setAlignment(Alignment);
|
||||
if (SrcGV->hasUnnamedAddr())
|
||||
DestGV->setUnnamedAddr(true);
|
||||
}
|
||||
|
||||
/// GetLinkageResult - This analyzes the two global values and determines what
|
||||
|
11
test/Linker/unnamed-addr1-a.ll
Normal file
11
test/Linker/unnamed-addr1-a.ll
Normal file
@ -0,0 +1,11 @@
|
||||
; RUN: llvm-link %s %p/unnamed-addr1-b.ll -S -o - | FileCheck %s
|
||||
|
||||
@foo = external global i32
|
||||
|
||||
define i32 @bar() {
|
||||
entry:
|
||||
%tmp = load i32* @foo, align 4
|
||||
ret i32 %tmp
|
||||
}
|
||||
|
||||
; CHECK: @foo = common unnamed_addr global i32 0, align 4
|
4
test/Linker/unnamed-addr1-b.ll
Normal file
4
test/Linker/unnamed-addr1-b.ll
Normal file
@ -0,0 +1,4 @@
|
||||
; This file is for use with unnamed-addr1-a.ll
|
||||
; RUN: true
|
||||
|
||||
@foo = common unnamed_addr global i32 0, align 4
|
11
test/Linker/unnamed-addr2-a.ll
Normal file
11
test/Linker/unnamed-addr2-a.ll
Normal file
@ -0,0 +1,11 @@
|
||||
; RUN: llvm-link %s %p/unnamed-addr2-b.ll -S -o - | FileCheck %s
|
||||
|
||||
define i32 @bar() {
|
||||
entry:
|
||||
%call = tail call i32 @foo()
|
||||
ret i32 %call
|
||||
}
|
||||
|
||||
declare i32 @foo()
|
||||
|
||||
; CHECK: define unnamed_addr i32 @foo()
|
7
test/Linker/unnamed-addr2-b.ll
Normal file
7
test/Linker/unnamed-addr2-b.ll
Normal file
@ -0,0 +1,7 @@
|
||||
; This file is for use with unnamed-addr2-a.ll
|
||||
; RUN: true
|
||||
|
||||
define unnamed_addr i32 @foo() {
|
||||
entry:
|
||||
ret i32 42
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user