Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Feb 2013 14:34:53 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        natris@centrum.cz, Konstantin Belousov <kostikbel@gmail.com>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>, Ryan Stone <rysto32@gmail.com>
Subject:   Re: SIGSEGV/SIGBUS when accessing after end of mmapped file; why it differs with GCC?
Message-ID:  <511E397D.1000005@FreeBSD.org>
In-Reply-To: <20130214150402.49631109@centrum.cz>
References:  <20130213171825.76D3A9DC@centrum.cz>, <CAFMmRNxkYKy_-GVSGAwM7Zjikwtezj1cR3mmzDjC1sqkv2Btog@mail.gmail.com> <20130213191208.GR2522@kib.kiev.ua> <20130214150402.49631109@centrum.cz>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2013-02-14 15:04, natris@centrum.cz wrote:
> Od: "Konstantin Belousov" <kostikbel@gmail.com>
>> On Wed, Feb 13, 2013 at 12:13:58PM -0500, Ryan Stone wrote:
>>> On Wed, Feb 13, 2013 at 11:18 AM, <natris@centrum.cz> wrote:
...
>>>> Machine in question runs amd64 FreeBSD 9.1-RC2, but this has also
...
>> You did not specified anything about version of the FreeBSD used, nor
>> the exact compiler invocations. Using the crystal ball, I see the
>> r244600 for HEAD and r244904 for stable/9, if you use --gc-sections
>> flags. This is more or less consistent with what you reported, since
>> gcc from ports uses binutils from ports, which have newer ld with
>> bugfix already applied.
...
> In my case it is indeed so that while the gcc42 generated binary does not contain the note, gcc47 binary does contain it. I am indeed using --gc-sections linker option, however whether this, potentially with some bug in linker, caused the note to be missing, I am not sure, as I did not investigate into this. The solution of the original problem is thus to ensure that the note presence is consistent and that the correct signal is handled.

As Kostik already pointed out, FreeBSD's ld contains a bug which
erroneously strips out the note sections, if you use --gc-sections.

I fixed that for head in r244600, and merged it to stable/9 in r244904.
Since you said you are running FreeBSD 9.1-RC2, you will not have this
particular fix, so it is the most likely cause for your problems.

The reason you do not see it with gcc 4.7 is that it will use a much
newer ld from the binutils port, where this issue with --gc-sections
was fixed a long time ago.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?511E397D.1000005>