Skip to content
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

Do not use -Wl,no-undefined when using sanitizers #3853

Open
Salamandar opened this issue Jul 9, 2018 · 4 comments
Open

Do not use -Wl,no-undefined when using sanitizers #3853

Salamandar opened this issue Jul 9, 2018 · 4 comments
Labels
compilers options Meson configuration options

Comments

@Salamandar
Copy link
Contributor

https://clang.llvm.org/docs/AddressSanitizer.html#id3

Right now, i've got lots of undefined references to the sanitizer runtime when linking the shared library.

@nirbheek nirbheek added compilers options Meson configuration options labels Jul 9, 2018
@jpakkane
Copy link
Member

jpakkane commented Jul 9, 2018

Starting with 0.47.0 we print a warning about this if the project has these settings.

@thmo
Copy link

thmo commented Aug 31, 2018

On Fedora 28, with meson 0.47.1 and clang 6.0.1, I still see undefined references when enabling sanitizers, unless I also set b_lundef=false.

@jeandet
Copy link
Member

jeandet commented Aug 31, 2018

@jpakkane are you sure about the warning?

[0/1] /usr/bin/python3 /usr/bin/meson --internal regenerate /home/jeandet/Documents/prog/testubsan-meson /home/jeandet/Documents/prog/testubsan-meson/build --backend ninja
The Meson build system
Version: 0.47.1
Source dir: /home/jeandet/Documents/prog/testubsan-meson
Build dir: /home/jeandet/Documents/prog/testubsan-meson/build
Build type: native build
Project name: clang-ubsan
Project version: undefined
Native C compiler: clang (clang 6.0.1 "clang version 6.0.1 (tags/RELEASE_601/final)")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Build targets in project: 3
Found ninja-1.8.2 at /usr/bin/ninja
[1/1] clang  -o libexe.so 'exe@sha/main.c.o' -fsanitize=undefined -Wl,--no-undefined -Wl,--as-needed -shared -fPIC -Wl,--start-group -Wl,-soname,libexe.so libfoo.a -Wl,--end-group  
FAILED: libexe.so 
clang  -o libexe.so 'exe@sha/main.c.o' -fsanitize=undefined -Wl,--no-undefined -Wl,--as-needed -shared -fPIC -Wl,--start-group -Wl,-soname,libexe.so libfoo.a -Wl,--end-group  
libfoo.a(foo.c.o) : Dans la fonction « foo » :
/home/jeandet/Documents/prog/testubsan-meson/build/../foo.c:4 : référence indéfinie vers « __ubsan_handle_nonnull_arg »
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

@nirbheek
Copy link
Member

nirbheek commented Sep 1, 2018

The PR for this was #3770. If it does not work, that needs to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compilers options Meson configuration options
Projects
None yet
Development

No branches or pull requests

5 participants