diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-03-26 15:48:59 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-03-26 15:48:59 +0000 |
commit | 5e46070516cd1db6aa4425c4026717f276fb4ce5 (patch) | |
tree | 2a0c4a26de1dceb644cf188fe8dcd8146f645c30 /llvm/lib/Support/FileUtilities.cpp | |
parent | ab5633b70c292592f68c9ae65fc2203fbe13f791 (diff) | |
download | bcm5719-llvm-5e46070516cd1db6aa4425c4026717f276fb4ce5.tar.gz bcm5719-llvm-5e46070516cd1db6aa4425c4026717f276fb4ce5.zip |
Avoid aliases to weak aliases in interceptors.
The interceptors had code that after macro expansion ended up looking like
extern "C" void memalign()
__attribute__((weak, alias("__interceptor_memalign")));
extern "C" void __interceptor_memalign() {}
extern "C" void __interceptor___libc_memalign()
__attribute__((alias("memalign")));
That is,
* __interceptor_memalign is a function
* memalign is a weak alias to __interceptor_memalign
* __interceptor___libc_memalign is an alias to memalign
Both gcc and clang produce assembly that look like
__interceptor_memalign:
...
.weak memalign
memalign = __interceptor_memalign
.globl __interceptor___libc_memalign
__interceptor___libc_memalign = memalign
What it means in the end is that we have 3 symbols pointing to the
same position in the file, one of which is weak:
8: 0000000000000000 1 FUNC GLOBAL DEFAULT 1
__interceptor_memalign
9: 0000000000000000 1 FUNC WEAK DEFAULT 1 memalign
10: 0000000000000000 1 FUNC GLOBAL DEFAULT 1
__interceptor___libc_memalign
In particular, note that __interceptor___libc_memalign will always
point to __interceptor_memalign, even if we do link in a strong symbol
for memalign. In fact, the above code produces exactly the same binary
as
extern "C" void memalign()
__attribute__((weak, alias("__interceptor_memalign")));
extern "C" void __interceptor_memalign() {}
extern "C" void __interceptor___libc_memalign()
__attribute__((alias("__interceptor_memalign")));
If nothing else, this patch makes it more obvious what is going on.
llvm-svn: 204823
Diffstat (limited to 'llvm/lib/Support/FileUtilities.cpp')
0 files changed, 0 insertions, 0 deletions