libsanitizer merge from upstream r175042

Konstantin Serebryany
Fri Feb 15 09:30:00 GMT 2013

On Fri, Feb 15, 2013 at 1:05 PM, Jakub Jelinek <> wrote:
> On Fri, Feb 15, 2013 at 12:47:30PM +0400, Konstantin Serebryany wrote:
>> This is ungood.
>> First, clang doesn't like it at all:
>> error: init_priority attribute requires integer
>> constant between 101 and 65535 inclusive
>> A __attribute__((init_priority (1))) a;
> For gcc it is just a warning, not error, so you can actually use it if you
> know what you are doing.
> Anyway, if gold doesn't have any way, you can always do the equivalent
> of shell
> which prelink 2>/dev/null && prelink -r 0x3600000000
> somewhere in the CMakeLists.txt.  That command doesn't affect system
> libraries, can be run as normal user, and just transforms a library
> from the default link state to -Wl,-Ttext-segment=0x3600000000
> state (including debug info etc.).  You'd need to apt-get install prelink
> or whatever command is for that on Ubuntu on the test boxes.

that's another option, not perfect though (someone not having prelink
on his/her box may break the tests w/o noticing).

> OT, unrelated thing, in include/asan_interface.h there is one
> #if __has_feature(address_sanitizer)
> which for GCC should better be:
> #if (defined __has_feature && __has_feature(address_sanitizer)) \
>     || defined(__SANITIZE_ADDRESS__)
> (and similarly in asan_internal.h).

z.c:1:44: error: missing binary operator before token "("
 #if (defined __has_feature && __has_feature(address_sanitizer)) \

This should be more like the code below

#if !defined(__has_feature)
#define __has_feature(x) 0
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)

[hopefully not starting a holly war] Any chance to teach gcc/cpp about


>         Jakub

More information about the Gcc-patches mailing list