-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GlobalMerge] Preserve symbol visibility when merging globals
Symbols created for merged external global variables have default visibility. This can break programs when compiling with -Oz -fvisibility=hidden as symbols that should be hidden will be exported at link time. Differential Revision: https://reviews.llvm.org/D73235 (cherry picked from commit a2fb2c0)
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
; RUN: llc %s -mtriple=arm-none-linux-gnu -o - | FileCheck %s | ||
; RUN: llc %s -mtriple=aarch64-none-linux-gnu -o - | FileCheck %s | ||
|
||
@x = hidden global i32 0, align 4 | ||
@y = hidden global i32 0, align 4 | ||
|
||
define hidden void @f() #0 { | ||
store i32 0, i32* @x, align 4 | ||
store i32 0, i32* @y, align 4 | ||
ret void | ||
} | ||
|
||
attributes #0 = { minsize optsize } | ||
|
||
; CHECK: .local .L_MergedGlobals | ||
; CHECK: .comm .L_MergedGlobals,8,4 | ||
|
||
; CHECK: .globl x | ||
; CHECK: .hidden x | ||
; CHECK: .set x, .L_MergedGlobals | ||
; CHECK: .size x, 4 | ||
|
||
; CHECK: .globl y | ||
; CHECK: .hidden y | ||
; CHECK: .set y, .L_MergedGlobals+4 | ||
; CHECK: .size y, 4 |