__attribute__((alias(foo))) and the hardening flags

Kevin Kofler kevin.kofler at chello.at
Fri Mar 13 01:09:59 UTC 2015


Jerry James wrote:
>                                          Since they contain identical
> symbols, the bundled polylmake version renames all of the symbols in
> the GMP-enabled version to have "_gmp" suffixes.  We did likewise, but
> to support applications that only want the GMP-enabled version and
> expect the original unaltered symbol names, we made declarations of
> the form "foo __attribute__((alias(foo_gmp)))" for each external
> symbol foo.
[snip]
> And this in the .dynsym section:
> 
>    109: 0000000000246100     0 OBJECT  GLOBAL DEFAULT   23 dd_purezero
>    634: 0000000000246100    32 OBJECT  GLOBAL DEFAULT   23 dd_purezero_gmp
> 
> So dd_purezero is not, in fact, an undefined symbol.  It is an alias
> to dd_purezero_gmp, which is defined and has the proper relocation
> type.

Don't use __attribute__((alias(foo_gmp))), use asm("foo_gmp"), as per:
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Asm-Labels.html

        Kevin Kofler



More information about the devel mailing list