public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mose at gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/101111] Undefined reference to ___lsan_default_suppressions when compiling GCC 11.1 for x86_64 macOS
Date: Thu, 17 Jun 2021 22:17:38 +0000	[thread overview]
Message-ID: <bug-101111-4-ccoerkBRif@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101111-4@http.gcc.gnu.org/bugzilla/>

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	other threads:[~2021-06-17 22:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 19:01 [Bug sanitizer/101111] New: " mose at gnu dot org
2021-06-17 22:17 ` mose at gnu dot org [this message]
2021-06-18 19:42 ` [Bug sanitizer/101111] xgcc cross-compiler for x86_64-apple-darwin in GCC 11.1 doesn't generate weak symbols, resulting in undefined reference to ___lsan_default_suppressions mose at gnu dot org
2021-06-18 19:50 ` pinskia at gcc dot gnu.org
2021-06-18 22:46 ` mose at gnu dot org
2021-06-18 23:24 ` mose at gnu dot org
2021-06-18 23:53 ` mose at gnu dot org
2021-07-19 20:33 ` mose at gnu dot org
2021-07-22 18:06 ` marxin at gcc dot gnu.org
2021-07-22 19:01 ` iains at gcc dot gnu.org
2021-07-25 10:54 ` iains at gcc dot gnu.org
2021-07-25 10:56 ` mose at gnu dot org
2021-08-03 11:25 ` cvs-commit at gcc dot gnu.org
2021-08-03 11:25 ` marxin at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-101111-4-ccoerkBRif@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).