support/scripts/check-host-rpath: send readelf error output to oblivion
PATCH 1/1 support/scripts/check-host-rpath: send readelf error output to oblivion
Somewhere between binutils 2.35 and 2.37, some functionality was added in readelf to parse more DWARF information. Unfortunately, as reported in binutils bug
28981 ("https://sourceware.org/bugzilla/show_bug.cgi?id=28981"), this feature causes a number of fairly scary warnings to be displayed when running readelf on binaries built with Clang, such as the pre-built rustc and rustdoc binaries part of the host-rust-bin package. It looks like this:
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x23
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Bogus end-of-siblings marker detected at offset 2f in .debug_info section
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x22
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Bogus end-of-siblings marker detected at offset 10b in .debug_info section
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Bogus end-of-siblings marker detected at offset 10c in .debug_info section
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Further warnings about bogus end-of-sibling markers suppressed
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x22
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x22
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x22
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x23
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x22
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x23
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x22
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x22
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x22
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x23
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x22
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x23
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form: 0x22
readelf: /home/thomas/projets/buildroot/output/host/bin/rustc: Warning: DIE at offset 0x1da refers to abbreviation number 5827 which does not exist
These warnings are caused by the readelf calls done by the support/scripts/check-host-rpath script. The annoying thing is that once host-rust-bin has been installed in $(HOST_DIR), this warning appears after the installation of every single host package, because support/scripts/check-host-rpath rescans all binaries every time.
To avoid showing those scary warnings, this commit sends the error output of readelf to /dev/null.
Of course, it would be nicer to only filter out those warnings, but filtering the error output without merging the error output into the standard output is tricky, so let's keep things simple. If there is really an error, readelf will abort.
--- support/scripts/check-host-rpath | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
support/scripts/check-host-rpath +2 -2
@@ -61,7 +61,7 @@ elf_needs_rpath() { while read lib; do [ -e "${hostdir}/lib/${lib}" ] && return 0 - done < <( readelf -d "${file}" \ + done < <( readelf -d "${file}" 2>/dev/null \ |sed -r -e '/^.* \(NEEDED\) .*Shared library: \[(.+)\]$/!d;' \ -e 's//\1/;' \ )
@@ -100,7 +100,7 @@ check_elf_has_rpath() { # false. [[ ${dir} =~ "${perpackagedir}/"[^/]+/host/lib ]] && return 0 done - done < <( readelf -d "${file}" \ + done < <( readelf -d "${file}" 2>/dev/null \ |sed -r -e '/.* \(R(UN)?PATH\) +Library r(un)?path: \[(.+)\]$/!d' \ -e 's//\3/;' \ )
Signature · 6 lines
2.37.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedThomas, All,
On 2022-07-27 12:47 +0200, Thomas Petazzoni via buildroot spake thusly:
Quoted 10 lines
Somewhere between binutils 2.35 and 2.37, some functionality was added in readelf to parse more DWARF information. Unfortunately, as reported in binutils bug
28981 ("https://sourceware.org/bugzilla/show_bug.cgi?id=28981"), this feature causes a number of fairly scary warnings to be displayed when running readelf on binaries built with Clang, such as the pre-built rustc and rustdoc binaries part of the host-rust-bin package. It looks like this:readelf:
/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x23
[--SNIP we got the idea, thanks--]
Quoted 9 lines
These warnings are caused by the readelf calls done by the support/scripts/check-host-rpath script. The annoying thing is that once host-rust-bin has been installed in $(HOST_DIR), this warning appears after the installation of every single host package, because support/scripts/check-host-rpath rescans all binaries every time.
To avoid showing those scary warnings, this commit sends the error output of readelf to
/dev/null.
Quoted 6 lines
Of course, it would be nicer to only filter out those warnings, but filtering the error output without merging the error output into the standard output is tricky, so let's keep things simple. If there is really an error, readelf will abort.
Signed-off-by Thomas Petazzoni <[email protected]>
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 33 lines
--- support/scripts/check-host-rpath | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)support/scripts/check-host-rpath +2
-2@@ -61,7 +61,7 @@ elf_needs_rpath() { while read lib; do [ -e "${hostdir}/lib/${lib}" ] && return 0 - done < <( readelf -d "${file}" \ + done < <( readelf -d "${file}" 2>/dev/null \ |sed -r -e '/^.* \(NEEDED\) .*Shared library: \[(.+)\]$/!d;' \ -e 's//\1/;' \ )@@ -100,7 +100,7 @@ check_elf_has_rpath() { # false. [[ ${dir} =~ "${perpackagedir}/"[^/]+/host/lib ]] && return 0 done - done < <( readelf -d "${file}" \ + done < <( readelf -d "${file}" 2>/dev/null \ |sed -r -e '/.* \(R(UN)?PATH\) +Library r(un)?path: \[(.+)\]$/!d' \ -e 's//\3/;' \ )Signature · 6 lines
2.37.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 8 lines · On Wed, 27 Jul 2022 18:40:57 +0200 "Yann E. MORIN" <[email protected]>…
Quoted 6 lines
Of course, it would be nicer to only filter out those warnings, but filtering the error output without merging the error output into the standard output is tricky, so let's keep things simple. If there is really an error, readelf will abort.
Signed-off-by Thomas Petazzoni <[email protected]>Applied to master, thanks.
Thanks! I must say I was kind of hoping you would come up with a way of keeping the errors displayed, while filtering the warnings :-)
But another issue in this script is that it doesn't have set -o pipefail, so if readelf fails, because the output is piped into another process, the script will not bork. Perhaps something to fix ;-) (hint hint!)
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas, All,
On 2022-07-27 19:42 +0200, Thomas Petazzoni via buildroot spake thusly:
Quoted 9 lines
Quoted 5 lines · On Wed, 27 Jul 2022 18:40:57 +0200 "Yann E. MORIN" <[email protected]>…
Quoted 4 lines
Of course, it would be nicer to only filter out those warnings, but filtering the error output without merging the error output into the standard output is tricky, so let's keep things simple. If there is really an error, readelf will abort.
Applied to master, thanks.
Thanks! I must say I was kind of hoping you would come up with a way of keeping the errors displayed, while filtering the warnings :-)
That's going to be a little bit convoluted...
Quoted 3 lines
But another issue in this script is that it doesn't have set -o pipefail, so if readelf fails, because the output is piped into another process, the script will not bork. Perhaps something to fix ;-) (hint hint!)
Using -o pipefail would not help, because the pipe is in a process substitution:
some-command < <( readelf blabla |sed foobar )
If we set -o pipefail, then the pipe will indeed fail, but the process substitution will not fail.
So, meh.
However, check-host-rpath is slow as hell; it would highly benefit from a makeover.
Regards,
Yann E. MORIN.
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 51 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni via buildroot <[email protected]> writes:
Somewhere between binutils 2.35 and 2.37, some functionality was added in readelf to parse more DWARF information. Unfortunately, as reported in binutils bug
28981 ("https://sourceware.org/bugzilla/show_bug.cgi?id=28981"), this feature causes a number of fairly scary warnings to be displayed when running readelf on binaries built with Clang, such as the pre-built rustc and rustdoc binaries part of the host-rust-bin package. It looks like this:readelf:
/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x23
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc:
Warning: Bogus end-of-siblings marker detected at offset 2f in
.debug_info section
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x22
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc:
Warning: Bogus end-of-siblings marker detected at offset 10b in
.debug_info section
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc:
Warning: Bogus end-of-siblings marker detected at offset 10c in
.debug_info section
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc:
Warning: Further warnings about bogus end-of-sibling markers
suppressed
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x22
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x22
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x22
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x23
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x22
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x23
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x22
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x22
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x22
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x23
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x22
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x23
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc: Warning: Unrecognized form:0x22
readelf:/home/thomas/projets/buildroot/output/host/bin/rustc:
Warning: DIE at offset0x1darefers to abbreviation number 5827 which
does not existThese warnings are caused by the readelf calls done by the support/scripts/check-host-rpath script. The annoying thing is that once host-rust-bin has been installed in $(HOST_DIR), this warning appears after the installation of every single host package, because support/scripts/check-host-rpath rescans all binaries every time.
To avoid showing those scary warnings, this commit sends the error output of readelf to
/dev/null.
Quoted 6 lines
Of course, it would be nicer to only filter out those warnings, but filtering the error output without merging the error output into the standard output is tricky, so let's keep things simple. If there is really an error, readelf will abort.
Signed-off-by Thomas Petazzoni <[email protected]>
Committed to 2022.05.x and 2022.02.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot