[PATCH 08/12] Rewrite abi-note.S in C.
Zack Weinberg
zackw@panix.com
Fri May 1 14:07:06 GMT 2020
On Fri, May 1, 2020 at 5:24 AM Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
> what about
>
> /* Note: Custom type is used as ElfW(Nhdr) is wrong on 64 bit targets. */
>
> __attribute__((used, aligned(4), section(".note.ABI-tag")))
> static const struct
> {
> int32_t namesz;
> int32_t descsz;
> int32_t type;
> char name[4];
> int32_t desc[4];
> } __abi_tag = {
> 4, /* name length: 4 */
> 16, /* data length: 4 32-bit numbers */
> 1,
> "GNU",
> { __ABI_TAG_OS, __ABI_TAG_VERSION }
> };
>
> this fixes the alignment, makes the symbol local, does not need
> endian.h and uses identifiers according to the gabi specification.
Looks good to me. Fixing the array length means the compiler should
complain if __ABI_TAG_VERSION ever expands to the wrong number of
initializers.
zw
More information about the Libc-alpha
mailing list