[Bug 267751] lang/gcc*: Address sanitizer isn't properly enabled: ASan runtime does not come first in initial library list

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 24 Nov 2022 21:34:46 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267751

--- Comment #9 from Lorenzo Salvadore <salvadore@freebsd.org> ---
I have tested successfully the patch for gcc12-devel too. However, the patch
for gcc13-devel does not seem to be completely successful: the compiled binary
starts, but it stops immediately with the following error from ASan.

AddressSanitizer:DEADLYSIGNAL
=================================================================
==83034==ERROR: AddressSanitizer: BUS on unknown address (pc 0x0008017ae145 bp
0x00000001445a sp 0x7fffffffafc8 T0)
==83034==The signal is caused by a READ memory access.
==83034==Hint: this fault was caused by a dereference of a high value address
(see register values below).  Disassemble the provided pc to learn which
register was used.
    #0 0x8017ae145  (/lib/libc.so.7+0x159145)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: BUS (/lib/libc.so.7+0x159145) 
==83034==ABORTING

I am doing my tests by compiling the following code:

#include <iostream>

using namespace std;

int main()
{
  cout << "Hello world!";
  return 0;
}

I still have to study what this error means, if it is one more bug indipendent
from the one we are fixing in this PR, if this is an expected issue in the HEAD
of the GCC development or whatelse. If anyone already knows something about it,
help is welcome.

In the meantime, here is the commit schedule for the other gcc ports:
- the commits for gcc11-devel and gcc12-devel will be done within the week
together with the updates to the latest snapshots;
- the commit for gcc12 will be done after the gcc11-devel and gcc12-devel
commits but before the commit of the GCC_DEFAULT update, which should be done
soon: indeed the exp run for it (bug #265948) has only one last known issue
(bug #266189) for which I have already submitted a patch to the maintainer
(which is you Yuri, but as you have probably seen it is only a USE_GCC=11
patch, so you might want to find a better solution);
- the commit for gcc11 will be done after the GCC_DEFAULT update.

I have built this schedule with the goal to reduce the gcc builds for users
that only need GCC_DEFAULT: with this plan, they should only need to build
gcc12 once and no gcc11.

-- 
You are receiving this mail because:
You are on the CC list for the bug.