[libc] Add Elf32_Xword type (#177915)

In a recent PR (https://github.com/llvm/llvm-project/pull/174772), we
introduced GnuPropertySection using ElfW(Xword). Since we are currently
missing Elf32_Xword, this is failing on 32bit architectures.

This commit adds the missing Elf32_Xword type that should always hold
64bit even on 32bit architectures.
This commit is contained in:
Jakob Koschel 2026-01-26 23:48:35 +01:00 committed by GitHub
parent 5188d2e745
commit dc55e20483
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 52 additions and 1 deletions

View File

@ -294,6 +294,7 @@ add_gen_header(
libc.include.llvm-libc-types.Elf32_Verneed
libc.include.llvm-libc-types.Elf32_Versym
libc.include.llvm-libc-types.Elf32_Word
libc.include.llvm-libc-types.Elf32_Xword
libc.include.llvm-libc-types.Elf64_Addr
libc.include.llvm-libc-types.Elf64_Chdr
libc.include.llvm-libc-types.Elf64_Dyn

View File

@ -648,6 +648,14 @@ add_proxy_header_library(
libc.include.llvm-libc-types.Elf32_Word
)
add_proxy_header_library(
Elf32_Xword
HDRS
Elf32_Xword.h
FULL_BUILD_DEPENDS
libc.include.llvm-libc-types.Elf32_Xword
)
add_proxy_header_library(
Elf64_Addr
HDRS

View File

@ -0,0 +1,22 @@
//===-- Proxy for Elf32_Xword ---------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_ELF32_XWORD_H
#define LLVM_LIBC_HDR_TYPES_ELF32_XWORD_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/Elf32_Xword.h"
#else // Overlay mode
#include <elf.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_ELF32_XWORD_H

View File

@ -497,6 +497,7 @@ add_header_macro(
.llvm-libc-types.Elf32_Verneed
.llvm-libc-types.Elf32_Versym
.llvm-libc-types.Elf32_Word
.llvm-libc-types.Elf32_Xword
.llvm-libc-types.Elf64_Addr
.llvm-libc-types.Elf64_Chdr
.llvm-libc-types.Elf64_Dyn
@ -800,7 +801,7 @@ add_header_macro(
../libc/include/wctype.yaml
wctype.h
DEPENDS
.llvm_libc_common_h
.llvm_libc_common_h
.llvm-libc-types.wint_t
)

View File

@ -461,6 +461,7 @@ types:
- type_name: Elf32_Verneed
- type_name: Elf32_Versym
- type_name: Elf32_Word
- type_name: Elf32_Xword
- type_name: Elf64_Addr
- type_name: Elf64_Chdr
- type_name: Elf64_Dyn

View File

@ -24,6 +24,7 @@
#include "../llvm-libc-types/Elf32_Sword.h"
#include "../llvm-libc-types/Elf32_Sym.h"
#include "../llvm-libc-types/Elf32_Word.h"
#include "../llvm-libc-types/Elf32_Xword.h"
#include "../llvm-libc-types/Elf64_Addr.h"
#include "../llvm-libc-types/Elf64_Chdr.h"
#include "../llvm-libc-types/Elf64_Dyn.h"

View File

@ -194,6 +194,7 @@ add_header(Elf32_Lword HDR Elf32_Lword.h DEPENDS libc.include.llvm-libc-macros.s
add_header(Elf32_Off HDR Elf32_Off.h DEPENDS libc.include.llvm-libc-macros.stdint_macros)
add_header(Elf32_Sword HDR Elf32_Sword.h DEPENDS libc.include.llvm-libc-macros.stdint_macros)
add_header(Elf32_Word HDR Elf32_Word.h DEPENDS libc.include.llvm-libc-macros.stdint_macros)
add_header(Elf32_Xword HDR Elf32_Xword.h DEPENDS libc.include.llvm-libc-macros.stdint_macros)
add_header(
Elf32_Chdr
HDR

View File

@ -0,0 +1,16 @@
//===-- Definition of Elf32_Xword type ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_TYPES_ELF32_XWORD_H
#define LLVM_LIBC_TYPES_ELF32_XWORD_H
#include "../llvm-libc-macros/stdint-macros.h"
typedef uint64_t Elf32_Xword;
#endif // LLVM_LIBC_TYPES_ELF32_XWORD_H