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

b_sanitize=address requires b_lundef=false? #764

Closed
rhd opened this issue Sep 7, 2016 · 7 comments
Closed

b_sanitize=address requires b_lundef=false? #764

rhd opened this issue Sep 7, 2016 · 7 comments

Comments

@rhd
Copy link
Contributor

rhd commented Sep 7, 2016

If I don't specify -Db_lundef=false at the same time I specify -Db_sanitize=address I get linker errors when building shared objects.

CC=clang CXX=clang++ meson.py -Db_sanitize=address -Db_lundef=false --buildtype=debugoptimized build-clang-asan

This caught me by surprise and took a while to figure out why the linker was failing.

Is it reasonable to automatically set b_lundef to false if b_sanitize is set to address (and possibly others)?

@jpakkane
Copy link
Member

jpakkane commented Sep 7, 2016

I tested this on Ubuntu and GCC works fine with undef but Clang does not. This makes things complicated we don't know if this is a gcc/clang behavioural mismatch or if gcc has been patched in Ubuntu to allow missing sanitizer symbols or to make -fsanitize link in the necessary symbols. The latter seems like the most sensible thing to me.

A good start would probably be to file a Clang bug about this difference. IMHO it should not complain about missing asan symbols if linker flag -fsanitize=address is passed (which we do).

@rhd
Copy link
Contributor Author

rhd commented Sep 7, 2016

My environment is centos 7 with gcc 4.8.5 and clang 3.4.2. It works fine with gcc but not clang - same as you on ubuntu.

@jpakkane
Copy link
Member

jpakkane commented Sep 8, 2016

Reported upstream.

@rhd
Copy link
Contributor Author

rhd commented Oct 2, 2016

It seems like there is no resolution in sight to this in the upstream bug report.

One guys says:

Perhaps the easiest thing would be to make Clang ignore -Wl,--no-undefined (with a warning) when compiling with a sanitizer enabled. Presumably non-sanitized builds will perform the checks the user is looking for.

Then someone says:

I've gone down that path previously and it breaks some people using -z defs as part of their configure checks.

Which meson doesn't have to care about - right? So maybe it's safe to have meson remove the -Wl,--no-undefined if a ASAN is specified?

@jpakkane
Copy link
Member

jpakkane commented Oct 2, 2016

Meson does not have functionality to set the default value of an option based on another option. Adding it would take a fair bit of work.

@rhd
Copy link
Contributor Author

rhd commented Oct 2, 2016

Maybe output a warning or info string then? It took a fair bit of googling to figure out what was happening when I came across this issue.

@NickeZ
Copy link
Contributor

NickeZ commented Mar 21, 2018

setting LDFLAGS=-lasan seems to be a workaround for this issue.

evverx added a commit to evverx/c-utf8 that referenced this issue Jun 14, 2022
to make it possible to build dbus-broker with clang and ASan/UBsan
on OSS-Fuzz (google/oss-fuzz#7860) without
sed scripts.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily.

mesonbuild/meson#764

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
evverx added a commit to evverx/c-dvar that referenced this issue Jun 14, 2022
to make it possible to build dbus-broker with clang and ASan/UBsan
on OSS-Fuzz (google/oss-fuzz#7860) without
sed scripts.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily.

mesonbuild/meson#764

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
evverx added a commit to evverx/c-rbtree that referenced this issue Jun 14, 2022
to make it possible to build dbus-broker with clang and ASan/UBsan
on OSS-Fuzz (google/oss-fuzz#7860) without
sed scripts.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily.

mesonbuild/meson#764

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
evverx added a commit to evverx/c-rbtree that referenced this issue Jun 14, 2022
to make it possible to build dbus-broker with clang and ASan/UBsan
on OSS-Fuzz (google/oss-fuzz#7860) without
sed scripts.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily.

mesonbuild/meson#764

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
evverx added a commit to evverx/c-ini that referenced this issue Jun 14, 2022
to make it possible to build dbus-broker with clang and ASan/UBsan
on OSS-Fuzz (google/oss-fuzz#7860) without
sed scripts.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily.

mesonbuild/meson#764

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
evverx added a commit to evverx/c-shquote that referenced this issue Jun 15, 2022
to make it possible to build dbus-broker with clang and ASan/UBsan
on OSS-Fuzz (google/oss-fuzz#7860) without
sed scripts.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily.

mesonbuild/meson#764

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
dvdhrm pushed a commit to c-util/c-utf8 that referenced this issue Jun 15, 2022
to make it possible to build dbus-broker with clang and ASan/UBsan
on OSS-Fuzz (google/oss-fuzz#7860) without
sed scripts.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily.

mesonbuild/meson#764

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
dvdhrm pushed a commit to c-util/c-shquote that referenced this issue Jun 15, 2022
to make it possible to build dbus-broker with clang and ASan/UBsan
on OSS-Fuzz (google/oss-fuzz#7860) without
sed scripts.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily.

mesonbuild/meson#764

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
dvdhrm pushed a commit to c-util/c-rbtree that referenced this issue Jun 15, 2022
to make it possible to build dbus-broker with clang and ASan/UBsan
on OSS-Fuzz (google/oss-fuzz#7860) without
sed scripts.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily.

mesonbuild/meson#764

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
dvdhrm pushed a commit to c-util/c-ini that referenced this issue Jun 15, 2022
to make it possible to build dbus-broker with clang and ASan/UBsan
on OSS-Fuzz (google/oss-fuzz#7860) without
sed scripts.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily.

mesonbuild/meson#764

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
dvdhrm pushed a commit to c-util/c-dvar that referenced this issue Jun 15, 2022
to make it possible to build dbus-broker with clang and ASan/UBsan
on OSS-Fuzz (google/oss-fuzz#7860) without
sed scripts.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily.

mesonbuild/meson#764

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
evverx added a commit to evverx/n-dhcp4 that referenced this issue Jan 28, 2023
to make it possible to build n-dhcp4 with clang and ASan.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily:
mesonbuild/meson#764

To get it to work the c-siphash submodule has to be bumped to at least
c-util/c-siphash@203347c
as well but it should probably be delayed until the next release or
something like that.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
thom311 pushed a commit to nettools/n-dhcp4 that referenced this issue May 4, 2023
to make it possible to build n-dhcp4 with clang and ASan.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily:
mesonbuild/meson#764

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
thom311 pushed a commit to nettools/n-dhcp4 that referenced this issue May 4, 2023
to make it possible to build n-dhcp4 with clang and ASan.

-Wl,--no-undefined is still passed by meson by default unless -Db_lundef
is set to false explictily:
mesonbuild/meson#764

To get it to work the c-siphash submodule has to be bumped to at least
c-util/c-siphash@203347c
as well but it should probably be delayed until the next release or
something like that.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>

#38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants