Re: [PATCH] compiler-gcc.h: Disable __retain on gcc-11
From: Andreas Schwab
Date: Tue Oct 01 2024 - 13:45:47 EST
On Sep 30 2024, Tony Ambardar wrote:
> On Tue, Sep 24, 2024 at 07:29:46PM +0200, Andreas Schwab wrote:
>> On Sep 24 2024, Geert Uytterhoeven wrote:
>>
>> > All my gcc-11 compilers (Ubuntu 11.4.0-1ubuntu1~22.04) claim to support
>> > the __retain__ attribute, but only riscv64-linux-gnu-gcc-11 and
>> > x86_64-linux-gnu-gcc-11 (not x86_64-linux-gnux32-gcc-11!) actually do.
>> > The arm-linux-gnueabi-gcc-11.5.0 compiler from kernel.org crosstool
>> > fails in the same way:
>> >
>> > error: ‘retain’ attribute ignored [-Werror=attributes]
>> >
>> > All my gcc-12 compilers seem to support the attribute.
>>
>> That ultimately depends on binutils support for SHF_GNU_RETAIN (2.36+).
>
> IIRC from working on the original patch, older linkers which do not
> support this 'R' flag would simply ignore it and not error out,
The assembler gives a fatal error for unrecognized section attributes
since binutils 2.15, and emitted a warning before that (but the gcc
check uses --fatal-warnings).
--
Andreas Schwab, schwab@xxxxxxxxxxxxxx
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."