[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d5c952c9-e7f6-4a01-9e43-2b19b586a95b@t-8ch.de>
Date: Sat, 3 Aug 2024 22:55:07 +0200 (GMT+02:00)
From: Thomas Weißschuh <thomas@...ch.de>
To: Willy Tarreau <w@....eu>
Cc: Thomas Weißschuh <linux@...ssschuh.net>,
Shuah Khan <shuah@...nel.org>, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH 04/12] tools/nolibc: use attribute((naked)) if available
Aug 3, 2024 20:33:11 Willy Tarreau <w@....eu>:
> On Sat, Aug 03, 2024 at 08:28:08PM +0200, Thomas Weißschuh wrote:
>>> I think that it can resolve to roughly this:
>>>
>>> #if defined(__has_attribute) && __has_attribute(naked)
>>> # define __entrypoint __attribute__((naked))
>>> # define __entrypoint_epilogue()
>>> #else
>>> # define __entrypoint __attribute__((optimize("Os", "omit-frame-pointer")))
>>> # define __entrypoint_epilogue() __builtin_unreachable()
>>> #endif
>>
>> We would need to duplicate the define for the
>> !defined(__has_attribute) case.
>
> I don't understand why. Above both are tested on the first line.
> Am I missing something ?
This specifically does not work [0]:
a result, combining the two tests into a single expression as shown below would only be valid with a compiler that supports the operator but not with others that don’t.
>
>> I wanted to avoid that duplication.
>>> What do you think ?
>>
>> With the reasoning above I'll let you choose.
>
> I'm fine with avoiding duplication, I just don't understand why there
> should be.
>
> Willy
[0] https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html
Powered by blists - more mailing lists