[Bug sanitizer/82829] New: libsanitizer build failure on darwin10 (Snow Leopard) due to missing getsectiondata

egallager at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 3 20:26:00 GMT 2017


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

            Bug ID: 82829
           Summary: libsanitizer build failure on darwin10 (Snow Leopard)
                    due to missing getsectiondata
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Keywords: build
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: egallager at gcc dot gnu.org
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---
              Host: x86_64-apple-darwin10
            Target: x86_64-apple-darwin10
             Build: x86_64-apple-darwin10

Trying to build gcc with MacPorts on OS X 10.6 results in the following error
in libsanitizer:

libtool: compile: 
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/build/./gcc/xgcc
-shared-libgcc
-B/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/build/./gcc
-nostdinc++
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/build/x86_64-apple-darwin10/libstdc++-v3/src
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/build/x86_64-apple-darwin10/libstdc++-v3/src/.libs
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/build/x86_64-apple-darwin10/libstdc++-v3/libsupc++/.libs
-B/opt/local/x86_64-apple-darwin10/bin/ -B/opt/local/x86_64-apple-darwin10/lib/
-isystem /opt/local/x86_64-apple-darwin10/include -isystem
/opt/local/x86_64-apple-darwin10/sys-include -D_GNU_SOURCE -D_DEBUG
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-DASAN_HAS_EXCEPTIONS=1 -DASAN_NEEDS_SEGV=1 -DCAN_SANITIZE_UB=0
-DMAC_INTERPOSE_FUNCTIONS -DMISSING_BLOCKS_SUPPORT -I.
-I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/gcc-7.2.0/libsanitizer/asan
-I.. -I
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/gcc-7.2.0/libsanitizer/include
-I
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/gcc-7.2.0/libsanitizer
-Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC
-fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables
-fvisibility=hidden -Wno-variadic-macros -fno-ipa-icf
-I../../libstdc++-v3/include -I../../libstdc++-v3/include/x86_64-apple-darwin10
-I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/gcc-7.2.0/libsanitizer/../libstdc++-v3/libsupc++
-std=gnu++11 -g -O2 -pipe -Os -MT asan_mac.lo -MD -MP -MF .deps/asan_mac.Tpo -c
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/gcc-7.2.0/libsanitizer/asan/asan_mac.cc
 -fno-common -DPIC -o .libs/asan_mac.o
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/gcc-7.2.0/libsanitizer/asan/asan_mac.cc:
In function 'void __asan::AsanApplyToGlobals(__asan::globals_op_fptr, const
void*)':
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/gcc-7.2.0/libsanitizer/asan/asan_mac.cc:84:45:
error: 'getsectiondata' was not declared in this scope
   __asan_global *globals = (__asan_global *)getsectiondata(
                                             ^~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/gcc-7.2.0/libsanitizer/asan/asan_mac.cc:84:45:
note: suggested alternative: 'getsectdata'
   __asan_global *globals = (__asan_global *)getsectiondata(
                                             ^~~~~~~~~~~~~~
                                             getsectdata

Same error results when trying to build it manually with the same options that
MacPorts uses. When building manually on Snow Leopard I usually hack around it
with a patch like this:

---
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/gcc-7.2.0/libsanitizer/asan/asan_mac.cc~
    2016-11-08 17:04:09.000000000 -0500
+++
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/libgcc/work/gcc-7.2.0/libsanitizer/asan/asan_mac.cc
     2017-11-03 16:10:03.000000000 -0400
@@ -81,10 +81,10 @@

   // Look up the __asan_globals section in that image and register its globals
   unsigned long size = 0;
-  __asan_global *globals = (__asan_global *)getsectiondata(
-      mh,
+  __asan_global *globals = (__asan_global *)getsectdata(
       "__DATA", "__asan_globals",
       &size);
+  (void)mh;

   if (!globals) return;
   if (size % sizeof(__asan_global) != 0) return;

This gets it to build but I don't know if it's actually correct. I'd almost
kinda prefer it if there were a configure flag to disable libsanitizer
completely for other occasions when it breaks...


More information about the Gcc-bugs mailing list