[Bug sanitizer/55599] New: switch from mach_override to mac interpose function support in libasan broke -static-libasan

howarth at nitro dot med.uc.edu gcc-bugzilla@gcc.gnu.org
Wed Dec 5 00:01:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55599

             Bug #: 55599
           Summary: switch from mach_override to mac interpose function
                    support in libasan broke -static-libasan
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: howarth@nitro.med.uc.edu
                CC: dodji@gcc.gnu.org, dvyukov@gcc.gnu.org,
                    jakub@gcc.gnu.org, kcc@gcc.gnu.org


After r194120, the -static-libasan option fails to find the required symbols
for linking libasan.a on x86_64-apple-darwin12. For example...

% g++-fsf-4.8 -g -static-libasan -fsanitize=address cond1.C
Undefined symbols for architecture x86_64:
  "__interception::OverrideFunction(unsigned long, unsigned long, unsigned
long*)", referenced from:
      __asan::InitializeMacInterceptors()      in libasan.a(asan_mac.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

% nm libasan.0.dylib  | grep OverrideFunction
                 U __ZN14__interception16OverrideFunctionEmmPm

% nm libasan.a | grep OverrideFunction
                 U __ZN14__interception16OverrideFunctionEmmPm

Oddly when compiling normally against the dynamic library...

% g++-fsf-4.8 -g -fsanitize=address cond1.C
% nm ./a.out | grep OverrideFunction
% ./a.out
%

...the resulting executable links in libasan.0.dylib but doesn't complain about
the undefined symbol on execution.



More information about the Gcc-bugs mailing list