Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ThinLTOBitcodeWriter: drop dso_local when a GlobalVariable is convert…
…ed to a declaration If we infer the dso_local flag for -fpic, dso_local should be dropped when we convert a GlobalVariable a declaration. dso_local causes the generation of direct access (e.g. R_X86_64_PC32). Such relocations referencing STB_GLOBAL STV_DEFAULT objects are not allowed in a -shared link. Reviewed By: tejohnson Differential Revision: https://reviews.llvm.org/D74749
- Loading branch information
Showing
3 changed files
with
29 additions
and
2 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
23 changes: 23 additions & 0 deletions
23
llvm/test/Transforms/ThinLTOBitcodeWriter/split-dsolocal.ll
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,23 @@ | ||
; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t %s | ||
; RUN: llvm-modextract -b -n 0 -o %t0.bc %t | ||
; RUN: llvm-modextract -b -n 1 -o %t1.bc %t | ||
; RUN: llvm-dis -o - %t0.bc | FileCheck --check-prefix=M0 %s | ||
; RUN: llvm-dis -o - %t1.bc | FileCheck --check-prefix=M1 %s | ||
|
||
; M0: @default = external constant [1 x i8] | ||
; M0: @hidden = external hidden constant [1 x i8] | ||
; M0: @al = external global [1 x i8] | ||
|
||
; M1: @default = dso_local constant [1 x i8] c"0", !type !0 | ||
; M1: @hidden = hidden constant [1 x i8] c"0", !type !0 | ||
; M1: @al = dso_local alias [1 x i8], [1 x i8]* @default | ||
@default = dso_local constant [1 x i8] c"0", !type !0 | ||
@hidden = dso_local hidden constant [1 x i8] c"0", !type !0 | ||
|
||
@al = dso_local alias [1 x i8], [1 x i8]* @default | ||
|
||
define [1 x i8]* @f_default() { ret [1 x i8]* @default } | ||
define [1 x i8]* @f_hidden() { ret [1 x i8]* @hidden } | ||
define [1 x i8]* @f_al() { ret [1 x i8]* @al } | ||
|
||
!0 = !{i32 0, !"typeid"} |