On x86_64-apple-darwin10, we fail the lto testcase... /sw/src/fink.build/gcc46-4.5.999-20100508/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc46-4.5.999-20100508/darwin_objdir/gcc/ -O0 -fwhopr -c -o c_lto_20081222_1.o /sw/src/fink.build/gcc46-4.5.999-20100508/gcc-4.6-20100508/gcc/testsuite/gcc.dg/lto/20081222_1.c /sw/src/fink.build/gcc46-4.5.999-20100508/gcc-4.6-20100508/gcc/testsuite/gcc.dg/lto/20081222_1.c:14:21: error: only weak aliases are supported in this configuration
The test case is.. cat 20081222_0.h int x(); cat 20081222_1.c #include "20081222_0.h" /* Actually, call "x" "INT_X", and make it hidden. */ extern __typeof (x) x __asm__ ("INT_x") __attribute__ (( __visibility__ ("hidden"))); int x () { return 7; } /* Make an externally-visible symbol "X" that's an alias for INT_x. */ extern __typeof (x) EXT_x __asm__ ("x") __attribute__ ((__alias__ ("INT_x"))); This compiles fine under Fedora 10 linux... gcc -O0 -c -o c_lto_20081222_1.o 20081222_1.c where as on x86_64-apple-darwin10 we get... gcc -O0 -c -o c_lto_20081222_1.o 20081222_1.c 20081222_1.c:16: error: only weak aliases are supported in this configuration Changing the last line of 20081222_1.c to "__attribute__ ((weak, __visibility__ ("hidden")));" changes the error on darwin to... gcc -O0 -c -o c_lto_20081222_1.o 20081222_1.c 20081222_1.c:16: error: ‘EXT_x’ aliased to undefined symbol ‘INT_x’ The fact that we pass testsuite/g++.old-deja/g++.ext/attrib5.C... // { dg-do run { xfail alpha*-dec-osf* i?86-pc-cygwin } } // Test that attributes weak and alias coexist. // { dg-require-weak "" } // { dg-require-alias "" } extern "C" { void _f () { } void f () __attribute__((weak, alias ("_f"))); } int main () { f (); } would seem to suggest that darwin has functional weak alias support. Are there any standards in effect which would dictate that the alias of a hidden function is valid? I find the logic of that a bit worrisome and wonder if it is really defined behavior. Thanks in advance for any comments. Jack