forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is an ELF-specific thing that adds SHF_LINK_ORDER to the global's section pointing to the metadata argument's section. The effect of that is a reverse dependency between sections for the linker GC. !associated does not change the behavior of global-dce. The global may also need to be added to llvm.compiler.used. Since SHF_LINK_ORDER is per-section, !associated effectively enables fdata-sections for the affected globals, the same as comdats do. Differential Revision: https://reviews.llvm.org/D29104 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298157 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
6 changed files
with
119 additions
and
16 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
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
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,39 @@ | ||
; RUN: llc -data-sections=1 -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s | ||
; RUN: llc -data-sections=0 -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s | ||
|
||
@a = global i32 1 | ||
@b = global i32 2, !associated !0 | ||
!0 = !{i32* @a} | ||
; CHECK-DAG: .section .data.b,"awm",@progbits,a | ||
|
||
; Loop is OK. Also, normally -data-sections=0 would place @c and @d in the same section. !associated prevents that. | ||
@c = global i32 2, !associated !2 | ||
@d = global i32 2, !associated !1 | ||
!1 = !{i32* @c} | ||
!2 = !{i32* @d} | ||
; CHECK-DAG: .section .data.c,"awm",@progbits,d | ||
; CHECK-DAG: .section .data.d,"awm",@progbits,c | ||
|
||
; BSS is OK. | ||
@e = global i32 0 | ||
@f = global i32 0, !associated !3 | ||
@g = global i32 1, !associated !3 | ||
!3 = !{i32* @e} | ||
; CHECK-DAG: .section .bss.f,"awm",@nobits,e | ||
; CHECK-DAG: .section .data.g,"awm",@progbits,e | ||
|
||
; Explicit sections. | ||
@h = global i32 1, section "aaa" | ||
@i = global i32 1, section "bbb", !associated !4 | ||
@j = global i32 1, section "bbb", !associated !4 | ||
@k = global i32 1, !associated !4 | ||
!4 = !{i32* @h} | ||
; CHECK-DAG: .section aaa,"aw",@progbits | ||
; CHECK-DAG: .section bbb,"awm",@progbits,h,unique,1 | ||
; CHECK-DAG: .section bbb,"awm",@progbits,h,unique,2 | ||
; CHECK-DAG: .section .data.k,"awm",@progbits,h | ||
|
||
; Non-GlobalObject metadata. | ||
@l = global i32 1, section "ccc", !associated !5 | ||
!5 = !{i32* null} | ||
; CHECK-DAG: .section ccc,"aw",@progbits |
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