2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
|
2009-02-21 08:24:10 +08:00
|
|
|
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: grep '@g0_ext = extern_weak global i32' %t
|
2009-02-21 08:24:10 +08:00
|
|
|
extern int g0_ext __attribute__((weak));
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: grep 'declare extern_weak i32 @g1_ext()' %t
|
2009-02-21 08:24:10 +08:00
|
|
|
extern int __attribute__((weak)) g1_ext (void);
|
|
|
|
|
[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: grep '@g0_common = weak dso_local global i32' %t
|
2009-02-21 08:24:10 +08:00
|
|
|
int g0_common __attribute__((weak));
|
|
|
|
|
[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: grep '@g0_def = weak dso_local global i32' %t
|
2009-02-21 08:24:10 +08:00
|
|
|
int g0_def __attribute__((weak)) = 52;
|
[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: grep 'define weak dso_local i32 @g1_def()' %t
|
2009-07-22 04:52:43 +08:00
|
|
|
int __attribute__((weak)) g1_def (void) { return 0; }
|
2009-02-21 08:24:10 +08:00
|
|
|
|
|
|
|
// Force _ext references
|
|
|
|
void f0() {
|
|
|
|
int a = g0_ext;
|
|
|
|
int b = g1_ext();
|
|
|
|
}
|
|
|
|
|