[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

howarth at nitro dot med.uc.edu gcc-bugzilla@gcc.gnu.org
Sun Feb 3 00:10:00 GMT 2013


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

--- Comment #46 from Jack Howarth <howarth at nitro dot med.uc.edu> 2013-02-03 00:10:02 UTC ---
(In reply to comment #40)
Also with the patch in Comment 42, the failing test case converted into a
shared library loaded via dlopen works fine...

% cat libcov.C
struct c18 { 
  virtual void bar() { }
};
c18 ret;

% cat covmain_dl.C
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
int main () {
void *lib_handle;
lib_handle = dlopen("./libcov.dylib", RTLD_LAZY);
if (!lib_handle) 
{
  fprintf(stderr, "%s\n", dlerror());
  exit(1);
}
dlclose(lib_handle);
}

% ./dist/bin/g++-fsf-4.8 -shared -fsanitize=address covmain_dl.C
% ./dist/bin/g++-fsf-4.8 -fsanitize=address covmain_dl.C
% ./a.out
%

This also works for a libcov.C compiled into a shared module loaded in
covmain_dl.C as libcov.so...

% ./dist/bin/g++-fsf-4.8 -bundle -fsanitize=address -o libcov.so libcov.C
% ./dist/bin/g++-fsf-4.8 -fsanitize=address covmain_dl.C
% a.out
%



More information about the Gcc-bugs mailing list