ramosian-glider / sanitizers

0 stars 0 forks source link

error: undefined reference to '__asan_report_load4' (firefox 3.6 / ubuntu / 32bit #112

Closed ramosian-glider closed 9 years ago

ramosian-glider commented 9 years ago

Originally reported on Google Code with ID 111

What steps will reproduce the problem?
1. I followed Clang-Getting Started to build LLVM and address-sanitizer
2. I checked out mozilla-1.9.2 (Firefox 3.6) with Mercurial
3. I am trying to build Firefox 3.6 with address-sanitizer on 32-bit Ubuntu 10.4. I
am generally following https://developer.mozilla.org/en-US/docs/Building_Firefox_with_Address_Sanitizer
though I have had to fix a small number of bugs/issues along the way

What is the expected output? What do you see instead?

What I am seeing (instead of a successful build) is:
/opt/build/Debug+Asserts/bin/clang++  -fno-rtti -fno-handle-exceptions -Wall -Wpointer-arith
-Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align
-Wno-invalid-offsetof -Wno-variadic-macros -Wno-long-long -pedantic -faddress-sanitizer
-Dxmalloc=myxmalloc -fno-strict-aliasing -pthread -pipe  -DDEBUG -D_DEBUG -DDEBUG_root
-DTRACING -g -fno-inline -O3 -fstrict-aliasing  -fPIC -shared -Wl,-z,defs -Wl,-h,libmozjs.so
-o libmozjs.so  jsapi.o jsarena.o jsarray.o jsatom.o jsbool.o jscntxt.o jsdate.o jsdbgapi.o
jsdhash.o jsdtoa.o jsemit.o jsexn.o jsfun.o jsgc.o jshash.o jsinterp.o jsinvoke.o jsiter.o
jslock.o jslog2.o jsmath.o jsnum.o jsobj.o json.o jsopcode.o jsparse.o jsprf.o jsregexp.o
jsscan.o jsscope.o jsscript.o jsstr.o jstask.o jsutil.o jsxdrapi.o jsxml.o prmjtime.o
jstracer.o Assembler.o Allocator.o CodeAlloc.o Containers.o Fragmento.o LIR.o RegAlloc.o
avmplus.o Nativei386.o jsbuiltins.o     -lpthread -faddress-sanitizer         -Wl,-rpath-link,/bin
-Wl,-rpath-link,/lib  -L/opt/192src/objdir-ff-asan/dist/lib -lplds4 -lplc4 -lnspr4
-lpthread -ldl -ldl -lm  -lm -ldl
ranlib libjs_static.a
/usr/bin/ld: jsapi.o: in function JS_GetNaNValue:/opt/192src/js/src/jsapi.cpp:129:
error: undefined reference to '__asan_report_load4'
/usr/bin/ld: jsapi.o: in function JS_GetNaNValue:/opt/192src/js/src/jsapi.cpp:129:
error: undefined reference to '__asan_report_load4'
/usr/bin/ld: jsapi.o: in function JS_GetNegativeInfinityValue:/opt/192src/js/src/jsapi.cpp:135:
error: undefined reference to '__asan_report_load4'
/usr/bin/ld: jsapi.o: in function JS_GetNegativeInfinityValue:/opt/192src/js/src/jsapi.cpp:135:
error: undefined reference to '__asan_report_load4'
/usr/bin/ld: jsapi.o: in function JS_ConvertArgumentsVA:/opt/192src/js/src/jsapi.cpp:211:
error: undefined reference to '__asan_report_store4'
/usr/bin/ld: jsapi.o: in function JS_ConvertArgumentsVA:/opt/192src/js/src/jsapi.cpp:194:
error: undefined reference to '__asan_report_store4'
/usr/bin/ld: jsapi.o: in function JS_ConvertArgumentsVA:/opt/192src/js/src/jsapi.cpp:196:
error: undefined reference to '__asan_report_load1'
/usr/bin/ld: jsapi.o: in function JS_ConvertArgumentsVA:/opt/192src/js/src/jsapi.cpp:245:
error: undefined reference to '__asan_report_load8'
/usr/bin/ld: jsapi.o: in function JS_ConvertArgumentsVA:/opt/192src/js/src/jsapi.cpp:220:
error: undefined reference to '__asan_report_store4'
/usr/bin/ld: jsapi.o: in function JS_ConvertArgumentsVA:/opt/192src/js/src/jsapi.cpp:220:
error: undefined reference to '__asan_report_store4'
/usr/bin/ld: jsapi.o: in function JS_ConvertArgumentsVA:/opt/192src/js/src/jsapi.cpp:245:
error: undefined reference to '__asan_report_store8'
/usr/bin/ld: jsapi.o: in function JS_ConvertArgumentsVA:/opt/192src/js/src/jsapi.cpp:196:
error: undefined reference to '__asan_report_load1'
/usr/bin/ld: jsapi.o: in function JS_ConvertArgumentsVA:/opt/192src/js/src/jsapi.cpp:196:
error: undefined reference to '__asan_report_load1'

What version of the product are you using? On what operating system?

Latest asan in LLVM

root@ubuntu:/opt/192src# uname -a
Linux ubuntu 2.6.32-42-generic #96-Ubuntu SMP Wed Aug 15 18:57:09 UTC 2012 i686 GNU/Linux

Please provide any additional information below.

I've attached the full build output (text file)

Reported by drtfrazier on 2012-09-12 20:50:29


ramosian-glider commented 9 years ago
When linking shared libraries you should not force asan symbols into .so
 -- symbols like __asan_* should be left undefined so that at the dynamic-link time
they are taken from the main binary. 
My guess is that if you remove  -Wl,-z,defs from the command line, it will work. 

Folks who wrote https://developer.mozilla.org/en-US/docs/Building_Firefox_with_Address_Sanitizer
had the same issue and solved it somehow.

Reported by konstantin.s.serebryany on 2012-09-13 05:12:37

ramosian-glider commented 9 years ago
Thank you - that did work. I have squashed several more issues but I have
found another that is preventing me from finishing this Firefox build. I am
hoping you might have some insight please?

Excerpt from make -f client.mk
 [...]
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory
`/opt/192src/objdir-ff-asan/js/ctypes/libffi/include'
Making all in testsuite
make[5]: Entering directory
`/opt/192src/objdir-ff-asan/js/ctypes/libffi/testsuite'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory
`/opt/192src/objdir-ff-asan/js/ctypes/libffi/testsuite'
Making all in man
make[5]: Entering directory
`/opt/192src/objdir-ff-asan/js/ctypes/libffi/man'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/opt/192src/objdir-ff-asan/js/ctypes/libffi/man'
make[5]: Entering directory `/opt/192src/objdir-ff-asan/js/ctypes/libffi'
depbase=`echo src/x86/sysv.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
        /bin/bash ./libtool   --mode=compile
/opt/build/Debug+Asserts/bin/clang -DHAVE_CONFIG_H -I.
-I/opt/192src/js/ctypes/libffi  -I. -I/opt/192src/js/ctypes/libffi/include
-Iinclude -I/opt/192src/js/ctypes/libffi/src  -I.
-I/opt/192src/js/ctypes/libffi/include -Iinclude
-I/opt/192src/js/ctypes/libffi/src -faddress-sanitizer -Dxmalloc=myxmalloc
-MT src/x86/sysv.lo -MD -MP -MF $depbase.Tpo -c -o src/x86/sysv.lo
/opt/192src/js/ctypes/libffi/src/x86/sysv.S &&\
        mv -f $depbase.Tpo $depbase.Plo
 /opt/build/Debug+Asserts/bin/clang -DHAVE_CONFIG_H -I.
-I/opt/192src/js/ctypes/libffi -I. -I/opt/192src/js/ctypes/libffi/include
-Iinclude -I/opt/192src/js/ctypes/libffi/src -I.
-I/opt/192src/js/ctypes/libffi/include -Iinclude
-I/opt/192src/js/ctypes/libffi/src -faddress-sanitizer -Dxmalloc=myxmalloc
-MT src/x86/sysv.lo -MD -MP -MF src/x86/.deps/sysv.Tpo -c
/opt/192src/js/ctypes/libffi/src/x86/sysv.S  -fPIC -DPIC -o src/x86/sysv.o
/opt/192src/js/ctypes/libffi/src/x86/sysv.S:360:17: error: invalid variant
'rel'
 .long .LFB1@rel
                ^
/opt/192src/js/ctypes/libffi/src/x86/sysv.S:387:17: error: invalid variant
'rel'
 .long .LFB2@rel
                ^
make[5]: *** [src/x86/sysv.lo] Error 1
make[5]: Leaving directory `/opt/192src/objdir-ff-asan/js/ctypes/libffi'

I have once again search high and low for simple problems/fixes and have
not found anything.

Reported by drtfrazier on 2012-09-16 13:53:37

ramosian-glider commented 9 years ago
Haven't see this. You better ask the ff folks first. 
Also, check it this builds with pure clang (i.e. w/o -faddress-sanitizer)
asan does not instrument .S files, so it is hardly involved here. 

Reported by konstantin.s.serebryany on 2012-09-17 08:51:27

ramosian-glider commented 9 years ago
Adding Project:AddressSanitizer as part of GitHub migration.

Reported by ramosian.glider on 2015-07-30 09:13:00