-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Building Spindle on non-x86_64 architectures (aarch64, ppc64, ppc64le) fails with a compile error
writablegot.c:124:50: error: 'DATA_GOT_TYPE' undeclared (first use in this function)
124 | if (ELF64_R_TYPE(datarels[j].r_info) != DATA_GOT_TYPE)
| ^~~~~~~~~~~~~
Root cause:
DATA_GOT_TYPE is defined in the architecture guard block in
Spindle/src/client/auditclient/writablegot.c
Lines 47 to 50 in 4174224
| #if defined(arch_x86_64) | |
| #define DEFAULT_RELENTSZ 24 | |
| #define EXTRA_GOT_ENTRIES 3 | |
| #define DATA_GOT_TYPE R_X86_64_GLOB_DAT |
but not defined for other architectures
Spindle/src/client/auditclient/writablegot.c
Lines 51 to 53 in 4174224
| #elif defined(arch_ppc64) || defined(arch_ppc64le) | |
| #define DEFAULT_RELENTSZ 24 | |
| #define EXTRA_GOT_ENTRIES 2 |
Spindle/src/client/auditclient/writablegot.c
Lines 54 to 56 in 4174224
| #elif defined(arch_aarch64) | |
| #define DEFAULT_RELENTSZ 24 | |
| #define EXTRA_GOT_ENTRIES 4 |
The macro is then used unconditionally at line 124 regardless of architecture, causing the build to
fail on any architecture other than x86_64.
Spindle/src/client/auditclient/writablegot.c
Lines 123 to 125 in 4174224
| unsigned long target = datarels[j].r_offset + map->l_addr; | |
| if (ELF64_R_TYPE(datarels[j].r_info) != DATA_GOT_TYPE) | |
| continue; |
Expected behavior
Spindle should build successfully on all supported architectures (x86_64, ppc64, aarch64).
Suggested fix
Add the appropriate ELF GLOB_DAT relocation type constant for each architecture in the guard block. The
correct constant names should be confirmed from <elf.h> on each target platform
| Arch | VAR_NAME | Source |
|---|---|---|
| PPC64 | R_PPC64_GLOB_DAT | elf.h L2710 |
| Aarch64 | R_AARCH64_GLOB_DAT | elf.h L3026 |
Environment
- Spindle: devel branch (commit 4174224)
- OS: Rocky Linux 10.1 (Red Quartz)
- Compiler: GCC 15 (gnu15 toolchain)
- Affected file: src/client/auditclient/writablegot.c:124