Re: [PATCH 04/12] tools/nolibc: use attribute((naked)) if available

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Aug 3, 2024 20:33:11 Willy Tarreau <w@xxxxxx>:

> 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





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux