[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-03 04:23:47 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -pic-level 2 -fsemantic-interposition -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-GD
|
|
|
|
// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -pic-level 2 -fsemantic-interposition -ftls-model=global-dynamic -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-GD
|
|
|
|
// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -pic-level 2 -fsemantic-interposition -ftls-model=local-dynamic -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-LD
|
2012-06-28 16:01:44 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -ftls-model=initial-exec -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-IE
|
|
|
|
// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -ftls-model=local-exec -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-LE
|
2015-07-29 00:27:56 +08:00
|
|
|
//
|
[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-03 04:23:47 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -pic-level 2 -fsemantic-interposition -femulated-tls -emit-llvm -o - 2>&1 | \
|
2015-07-29 00:27:56 +08:00
|
|
|
// RUN: FileCheck %s -check-prefix=CHECK-GD
|
2012-06-28 16:01:44 +08:00
|
|
|
|
2015-07-29 00:27:56 +08:00
|
|
|
int z1 = 0;
|
|
|
|
int z2;
|
2012-06-28 16:01:44 +08:00
|
|
|
int __thread x;
|
|
|
|
int f() {
|
|
|
|
static int __thread y;
|
|
|
|
return y++;
|
|
|
|
}
|
|
|
|
int __thread __attribute__((tls_model("initial-exec"))) z;
|
|
|
|
|
2015-07-29 00:27:56 +08:00
|
|
|
// Note that unlike normal C uninitialized global variables,
|
|
|
|
// uninitialized TLS variables do NOT have COMMON linkage.
|
|
|
|
|
|
|
|
// CHECK-GD: @z1 = global i32 0
|
2012-06-28 16:01:44 +08:00
|
|
|
// CHECK-GD: @f.y = internal thread_local global i32 0
|
2015-07-29 00:27:56 +08:00
|
|
|
// CHECK-GD: @z2 = common global i32 0
|
2012-06-28 16:01:44 +08:00
|
|
|
// CHECK-GD: @x = thread_local global i32 0
|
|
|
|
// CHECK-GD: @z = thread_local(initialexec) global i32 0
|
|
|
|
|
2015-07-29 00:27:56 +08:00
|
|
|
// CHECK-LD: @z1 = global i32 0
|
2012-06-28 16:01:44 +08:00
|
|
|
// CHECK-LD: @f.y = internal thread_local(localdynamic) global i32 0
|
2015-07-29 00:27:56 +08:00
|
|
|
// CHECK-LD: @z2 = common global i32 0
|
2012-06-28 16:01:44 +08:00
|
|
|
// CHECK-LD: @x = thread_local(localdynamic) global i32 0
|
|
|
|
// CHECK-LD: @z = thread_local(initialexec) global i32 0
|
|
|
|
|
[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-03 04:23:47 +08:00
|
|
|
// CHECK-IE: @z1 = dso_local global i32 0
|
2012-06-28 16:01:44 +08:00
|
|
|
// CHECK-IE: @f.y = internal thread_local(initialexec) global i32 0
|
[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-03 04:23:47 +08:00
|
|
|
// CHECK-IE: @z2 = common dso_local global i32 0
|
|
|
|
// CHECK-IE: @x = dso_local thread_local(initialexec) global i32 0
|
|
|
|
// CHECK-IE: @z = dso_local thread_local(initialexec) global i32 0
|
2012-06-28 16:01:44 +08:00
|
|
|
|
[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-03 04:23:47 +08:00
|
|
|
// CHECK-LE: @z1 = dso_local global i32 0
|
2012-06-28 16:01:44 +08:00
|
|
|
// CHECK-LE: @f.y = internal thread_local(localexec) global i32 0
|
[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-03 04:23:47 +08:00
|
|
|
// CHECK-LE: @z2 = common dso_local global i32 0
|
|
|
|
// CHECK-LE: @x = dso_local thread_local(localexec) global i32 0
|
|
|
|
// CHECK-LE: @z = dso_local thread_local(initialexec) global i32 0
|