diff options
author | Haibo Huang <hhb@google.com> | 2018-12-20 21:33:59 +0000 |
---|---|---|
committer | Haibo Huang <hhb@google.com> | 2018-12-20 21:33:59 +0000 |
commit | 303b2333e40318adf22f721297c42902466fa3b8 (patch) | |
tree | 9102d2d7aaef102201f9dd88a8b616c79212ab00 /clang/test/CodeGen | |
parent | d001380a69cdc546b2724d3305b167644f6151f4 (diff) | |
download | bcm5719-llvm-303b2333e40318adf22f721297c42902466fa3b8.tar.gz bcm5719-llvm-303b2333e40318adf22f721297c42902466fa3b8.zip |
Declares __cpu_model as dso local
__builtin_cpu_supports and __builtin_cpu_is use information in __cpu_model to decide cpu features. Before this change, __cpu_model was not declared as dso local. The generated code looks up the address in GOT when reading __cpu_model. This makes it impossible to use these functions in ifunc, because at that time GOT entries have not been relocated. This change makes it dso local.
Differential Revision: https://reviews.llvm.org/D53850
llvm-svn: 349825
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r-- | clang/test/CodeGen/builtin-cpu-is.c | 2 | ||||
-rw-r--r-- | clang/test/CodeGen/builtin-cpu-supports.c | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/CodeGen/builtin-cpu-is.c b/clang/test/CodeGen/builtin-cpu-is.c index f2a5f54a0c8..bff3544c136 100644 --- a/clang/test/CodeGen/builtin-cpu-is.c +++ b/clang/test/CodeGen/builtin-cpu-is.c @@ -4,6 +4,8 @@ // global, the bit grab, and the icmp correct. extern void a(const char *); +// CHECK: @__cpu_model = external dso_local global { i32, i32, i32, [1 x i32] } + void intel() { if (__builtin_cpu_is("intel")) a("intel"); diff --git a/clang/test/CodeGen/builtin-cpu-supports.c b/clang/test/CodeGen/builtin-cpu-supports.c index d384efbc208..761f00cf957 100644 --- a/clang/test/CodeGen/builtin-cpu-supports.c +++ b/clang/test/CodeGen/builtin-cpu-supports.c @@ -4,6 +4,9 @@ // global, the bit grab, and the icmp correct. extern void a(const char *); +// CHECK: @__cpu_model = external dso_local global { i32, i32, i32, [1 x i32] } +// CHECK: @__cpu_features2 = external dso_local global i32 + int main() { __builtin_cpu_init(); @@ -25,3 +28,5 @@ int main() { return 0; } + +// CHECK: declare dso_local void @__cpu_indicator_init() |