meson: Underscore prefix detection broken if -g specified
This is not an issue currently, due to #5481 hiding this bug but once that is solved, it will become an issue again.
If the cflags contain -g
, the test for the underscore symbol would incorrectly return as soon as it finds the symbol with or without underscore, but when debug symbols are enabled using -g
, this will yield the false result. This can easily be illustrated by a small testcase:
symbol_name = b'meson_uscore_prefix'
with open('out.obj', 'rb') as o:
for line in o:
# Check if the underscore form of the symbol is somewhere
# in the output file.
if b'_' + symbol_name in line:
print('True')
# Else, check if the non-underscored form is present
elif symbol_name in line:
print('False')
Would print:
False
True
as it first finds the symbol without the underscore, only later finds the symbol with underscore.
Of course this is not an issue when using the meson buildtype option, as meson will not use the -g
argument from that for the test, but is an issue when -g
is contained in externally provided flags by env variables or crossfile.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (15 by maintainers)
Links to this issue
Commits related to this issue
- contrib: Do not pass debug/optim flags to meson This fixes the meson underscore prefix test, which misbehaves when -g is passed, as it would detect the debug string without underscore first and incor... — committed to videolan/vlc by ePirat 5 years ago
- contrib: Do not pass debug/optim flags to meson This fixes the meson underscore prefix test, which misbehaves when -g is passed, as it would detect the debug string without underscore first and incor... — committed to videolan/vlc by ePirat 5 years ago
- contrib: Do not pass debug/optim flags to meson This fixes the meson underscore prefix test, which misbehaves when -g is passed, as it would detect the debug string without underscore first and incor... — committed to videolan/vlc-3.0 by ePirat 5 years ago
- tools/depends: update meson-cross-setup.sh to strip -g from C/CXX flags to work around meson bug meson bug: https://github.com/mesonbuild/meson/issues/5482 — committed to lrusak/xbmc by lrusak 4 years ago
- tools/depends: update meson-cross-setup.sh to strip -g from C/CXX flags to work around meson bug meson bug: https://github.com/mesonbuild/meson/issues/5482 — committed to lrusak/xbmc by lrusak 4 years ago
- tools/depends: update meson-cross-setup.sh to strip -g from C/CXX flags to work around meson bug meson bug: https://github.com/mesonbuild/meson/issues/5482 — committed to lrusak/xbmc by lrusak 4 years ago
- Downgrade to meson 0.51.0 due to prefix detection bug Reproduced on debug builds when Conan passes additional '-g' flag to CFLAGS. Meson fails to drop duplicate '-g' flags and the dav1d check 'cc.sym... — committed to theirix/conan-center-index by theirix 3 years ago
- (#4418) Add dav1d/0.8.1 * Add dav1d/0.8.1 * Use dl, pthread * Add bin to PATH Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * Add pkg_config anme * Enable assembly option b... — committed to conan-io/conan-center-index by theirix 3 years ago
- tools/depends: update meson-cross-setup.sh to strip -g from C/CXX flags to work around meson bug meson bug: https://github.com/mesonbuild/meson/issues/5482 — committed to nkichukov/xbmc by lrusak 4 years ago
- deinterlace: force -DPREFIX on macos This is due to a bug in meson where it will not detect properly the compiler if the symbols need an undercore. https://github.com/mesonbuild/meson/issues/5482 Fi... — committed to pexip/gst-plugins-good by nacho 4 years ago
- Fix oss-fuzz coverage build failure of dav1d The cc.symbols_have_underscore_prefix() test in dav1d/meson.build returns the incorrect value (true) if -fprofile-instr-generate is specified in the CFLAG... — committed to wantehchang/libavif by wantehchang 3 years ago
- Fix oss-fuzz coverage build failure of dav1d The cc.symbols_have_underscore_prefix() test in dav1d/meson.build returns the incorrect value (true) if -fprofile-instr-generate is specified in the CFLAG... — committed to AOMediaCodec/libavif by wantehchang 3 years ago
- clike: add more reliable ways to check underscore prefix Fix #5482 — committed to ePirat/meson by ePirat 2 years ago
- clike: add more reliable ways to check underscore prefix Fix #5482 — committed to ePirat/meson by ePirat 2 years ago
- clike: add more reliable ways to check underscore prefix Fix #5482 — committed to ePirat/meson by ePirat 2 years ago
- clike: add more reliable ways to check underscore prefix Fix #5482 — committed to ePirat/meson by ePirat 2 years ago
- clike: add more reliable ways to check underscore prefix Fix #5482 — committed to ePirat/meson by ePirat 2 years ago
- clike: add more reliable ways to check underscore prefix Fix #5482 — committed to ePirat/meson by ePirat 2 years ago
@nirbheek Doing that is really tricky given the amount of platforms meson already supports, but I found a much better solution, will submit the PR for this probably tomorrow evening.