NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/59391: unnecessary __PIC__ conditionals clutter .S files
The following reply was made to PR lib/59391; it has been noted by GNATS.
From: Valery Ushakov <uwe%stderr.spb.ru@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: lib/59391: unnecessary __PIC__ conditionals clutter .S files
Date: Sat, 3 May 2025 17:07:24 +0300
> Sometimes entire files are conditionalized on __PIC__, such as:
>
> https://nxr.netbsd.org/xref/src/lib/libc/arch/sparc/gen/sigsetjmp.S?r=1.7
Which, in this particular case, is, IMHO, the best way to write it.
It has two slight problems. First, when last time I touched this, I
was lazy and didn't comment the static version the same way I did for
dynamic. Second, unfortunately the preprocessor symbol is PIC, so
instead of more natural:
#if static
...
// more simple static version
...
#else // PIC
...
// jump through pic hoops that obscure the logic a bit
...
#endif
you either get ungly inverted "if !PIC" condition preceding static
part or get the more obscure dynamic "if PIC" version firts, like here
and in most of the rest of the code in the tree.
But trying to cram this into one text for static and PIC with macro
magic will be a bad idea.
-uwe
Home |
Main Index |
Thread Index |
Old Index