]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/dead_strip-weak-coalesce/foo.c
4cd4cfb6a3c8fcf6d324f7b8095df4041d071464
[apple/ld64.git] / unit-tests / test-cases / dead_strip-weak-coalesce / foo.c
1
2 // function can be coalesced and should not be dead stripped
3 void __attribute__ ((weak, section ("__TEXT,__text_no_strip,regular,no_dead_strip"))) foo()
4 {
5
6 }
7
8
9 // function should not be exported, can be coalesced, and should not be dead stripped
10 void __attribute__ ((weak, visibility("hidden"), section ("__TEXT,__text_no_strip,regular,no_dead_strip"))) hidden()
11 {
12
13 }
14
15 // bar should be dead stripped
16 void __attribute__ ((weak, section ("__DATA,__text2"))) bar()
17 {
18
19 }
20
21 __attribute__((constructor)) static void init()
22 {
23 foo();
24 hidden();
25 }