-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when asan doesn't report anything when link with 3rd party .o and library?? #1420
Comments
This SEGV has nothing to do with main() from example? |
i pasted wrong output. i has modified it. @vitalybuka |
@vitalybuka did you find any problem? how can i solve it |
lsan can't guaranty finding all leaks. Probably pointer is still alive somewhere on the stack. |
but if i don't link with 3rd-party .o and 3rd-party .so, the leak can be detected. why the 3rd-party library can affect this?
and so far as i know, the only difference is if i link with 3rd-party library, there is some static objects in the library will be initialized before the main function. |
you can try to add more leaks into the program assigning into the same var. int main(int, char**) { |
and get the follow report :
for now everything is right. but when i link it with a 3rd-party .o and a 3rd-party library, the asan doesn't report the error anymore.
first, i compile the test.cpp to test.o :
/usr/bin/g++ -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections -Bdynamic -Wl,-z,nocopyreloc -pie -Lout/target/product/x86/obj/lib -Wl,-rpath-link=out/target/product/x86/obj/lib -Wl,-rpath,\$ORIGIN/../lib test.o -Wl,--whole-archive -Wl,--no-whole-archive -lsqlite -o a.out -fsanitize=address -fno-omit-frame-pointer -ldl -lpthread -lm
and then link it with a 3rd-party .o and a 3rd-party .so
/usr/bin/g++ -Lout/target/product/x86/obj/lib -Wl,-rpath,\$ORIGIN/../lib out/target/product/x86/obj/EXECUTABLES/thirdparty_demo_intermediates/thirdparty_demo.o test.o -lthirdpartylib -lsqlite -o test -fsanitize=address -fno-omit-frame-pointer -ldl -lpthread -lm
and i run the test, the asan doesn't have the memory leak report.
the attachment is my 2 executables, one without link to 3rdpart library, another is linked with 3rd -party library named test-3rdparty.
output.zip
i have tried with g++ 5.4 and g++ 7.5
The text was updated successfully, but these errors were encountered: