https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101111

--- Comment #1 from Mosè Giordano <mose at gnu dot org> ---
To add more information, the real problem seems to be that xgcc can't generate
weak symbols:


sandbox:${WORKSPACE}/srcdir/gcc_build # x86_64-apple-darwin14-nm
x86_64-apple-darwin14/libsanitizer/lsan/.libs/lsan_common.o | grep '___lsan'
00000000000018c0 T ___lsan_default_options
                 U ___lsan_default_suppressions
00000000000018a0 T ___lsan_disable
0000000000003440 T ___lsan_do_leak_check
0000000000003460 T ___lsan_do_recoverable_leak_check
00000000000018b0 T ___lsan_enable
00000000000014c0 T ___lsan_ignore_object
                 U ___lsan_default_suppressions
0000000000001580 T ___lsan_register_root_region
00000000000017c0 T ___lsan_unregister_root_region


___lsan_default_suppressions and ___lsan_default_suppressions should be weak,
instead they're undefined.  I can reproduce the same issue with this simpler
example:


sandbox:${WORKSPACE}/srcdir/gcc_build # /workspace/srcdir/gcc_build/./gcc/xgcc
-B/workspace/srcdir/gcc_build/./gcc -x c - << EOF
#include <stdio.h>
int __attribute__((weak)) func(int);
#if 0                               
int func(int a) { return 2 * a; }   
#endif                              
int main() {                        
    if (&func) {                        
        printf("Func implemented: %d\n", func(10));
    } else {                                       
        printf("Func not implemented\n");          
    }                                              
    return 0;                                      
}                                                  
EOF                                                
Undefined symbols for architecture x86_64:
  "_func", referenced from:
      _main in ccMDdanO.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

Reply via email to