[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition
Summary:
Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults
to -fsemantic-interposition).
Users need to specify -fsemantic-interposition to get semantic
interposition behavior.
Semantic interposition is currently a best-effort feature. There may
still be some cases where it is not handled well.
Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert
Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73865
2020-02-02 12:23:47 -08:00
|
|
|
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple x86_64-linux-gnu -fsemantic-interposition | FileCheck --check-prefix=CHECK --check-prefix=LINUX %s
|
2015-11-11 22:42:31 +00:00
|
|
|
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple x86_64-apple-darwin12 | FileCheck --check-prefix=CHECK --check-prefix=DARWIN %s
|
2013-04-19 16:42:07 +00:00
|
|
|
|
|
|
|
int &f();
|
|
|
|
|
[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition
Summary:
Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults
to -fsemantic-interposition).
Users need to specify -fsemantic-interposition to get semantic
interposition behavior.
Semantic interposition is currently a best-effort feature. There may
still be some cases where it is not handled well.
Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert
Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73865
2020-02-02 12:23:47 -08:00
|
|
|
// LINUX: @r = thread_local dso_local global i32* null
|
2015-11-11 22:42:31 +00:00
|
|
|
// DARWIN: @r = internal thread_local global i32* null
|
2013-04-19 16:42:07 +00:00
|
|
|
thread_local int &r = f();
|
|
|
|
|
2015-11-11 22:42:31 +00:00
|
|
|
// LINUX: @_ZTH1r = alias void (), void ()* @__tls_init
|
|
|
|
// DARWIN: @_ZTH1r = internal alias void (), void ()* @__tls_init
|
2013-04-19 16:42:07 +00:00
|
|
|
|
|
|
|
int &g() { return r; }
|
|
|
|
|
|
|
|
// CHECK: define {{.*}} @[[R_INIT:.*]]()
|
2014-07-18 15:52:10 +00:00
|
|
|
// CHECK: call dereferenceable({{[0-9]+}}) i32* @_Z1fv()
|
2013-04-19 16:42:07 +00:00
|
|
|
// CHECK: store i32* %{{.*}}, i32** @r, align 8
|
|
|
|
|
[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition
Summary:
Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults
to -fsemantic-interposition).
Users need to specify -fsemantic-interposition to get semantic
interposition behavior.
Semantic interposition is currently a best-effort feature. There may
still be some cases where it is not handled well.
Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert
Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73865
2020-02-02 12:23:47 -08:00
|
|
|
// CHECK-LABEL: define dso_local dereferenceable({{[0-9]+}}) i32* @_Z1gv()
|
2015-12-17 00:42:36 +00:00
|
|
|
// LINUX: call i32* @_ZTW1r()
|
|
|
|
// DARWIN: call cxx_fast_tlscc i32* @_ZTW1r()
|
2013-04-19 16:42:07 +00:00
|
|
|
// CHECK: ret i32* %{{.*}}
|
|
|
|
|
2019-12-17 00:20:32 +02:00
|
|
|
// LINUX: define weak_odr hidden i32* @_ZTW1r() [[ATTR0:#[0-9]+]] comdat {
|
2016-01-15 03:34:06 +00:00
|
|
|
// DARWIN: define cxx_fast_tlscc i32* @_ZTW1r() [[ATTR1:#[0-9]+]] {
|
2016-03-18 23:35:21 +00:00
|
|
|
// LINUX: call void @_ZTH1r()
|
|
|
|
// DARWIN: call cxx_fast_tlscc void @_ZTH1r()
|
2015-02-27 21:19:58 +00:00
|
|
|
// CHECK: load i32*, i32** @r, align 8
|
2013-04-19 16:42:07 +00:00
|
|
|
// CHECK: ret i32* %{{.*}}
|
|
|
|
|
2016-03-18 23:35:21 +00:00
|
|
|
// LINUX-LABEL: define internal void @__tls_init()
|
|
|
|
// DARWIN-LABEL: define internal cxx_fast_tlscc void @__tls_init()
|
2013-04-19 16:42:07 +00:00
|
|
|
// CHECK: call void @[[R_INIT]]()
|
2015-12-17 00:42:36 +00:00
|
|
|
|
2016-01-15 03:34:06 +00:00
|
|
|
// LINUX: attributes [[ATTR0]] = { {{.*}}"target-features"{{.*}} }
|
|
|
|
// DARWIN: attributes [[ATTR1]] = { {{.*}}nounwind{{.*}}"target-features"{{.*}} }
|