]> git.ipfire.org Git - thirdparty/gcc.git/commit
driver: Fix up -freport-bug for ASLR [PR119727]
authorJakub Jelinek <jakub@redhat.com>
Sat, 12 Apr 2025 11:15:13 +0000 (13:15 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 13 Jun 2025 11:04:34 +0000 (13:04 +0200)
commitd3c3322577ca0d37adf47e1b67f35be003a7425d
tree3a0a341df01e3e7cf79cca5d55c30540491772d9
parenteed92f521f346c263666768874006d581d4911d1
driver: Fix up -freport-bug for ASLR [PR119727]

With --enable-host-pie -freport-bug almost never prepares preprocessed
source and instead emits
The bug is not reproducible, so it is likely a hardware or OS problem.
message even for bogus which are 100% reproducible.
The way -freport-bug works is that it reruns it 3 times, capturing stdout
and stderr from each and then tries to compare the outputs in between
different runs.
The libbacktrace emitted hexadecimal addresses at the start of the lines
can differ between runs due to ASLR, either of the PIE executable, or
even if not PIE if there is some frame with e.g. libc function (say
crash in strlen/memcpy etc.).

The following patch fixes it by ignoring such differences at the start of
the lines.

2025-04-12  Jakub Jelinek  <jakub@redhat.com>

PR driver/119727
* gcc.cc (files_equal_p): Rewritten using fopen/fgets/fclose instead
of open/fstat/read/close.  At the start of lines, ignore lowercase
hexadecimal addresses followed by space.

(cherry picked from commit 8b2ceb421f045ee8b39d7941f39f1e9a67217583)
gcc/gcc.cc