From b90d6b35a6add03f201ee217c430ecbcfc04eb3a Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 26 Mar 2024 19:15:42 +0000 Subject: [PATCH] elf.h: add EF_RISCV_FLOAT_ABI. See code comments for details. I think everything we could reasonably upstream from this file is now an upstream pull request. If they get in, I'll try my luck with the arm32 TLS constant (which is a bit more interesting because there's a probably obsolete conflict upstream, but someone who knows about FreeBSD/arm32 would want to look at that). Test: treehugger Change-Id: I5bf197045940d25efb2a520716499d924c362b57 --- libc/include/elf.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libc/include/elf.h b/libc/include/elf.h index bb3c61ae2..1275f2ede 100644 --- a/libc/include/elf.h +++ b/libc/include/elf.h @@ -254,7 +254,7 @@ typedef Elf64_Xword Elf64_Relr; #define DT_ANDROID_RELA 0x60000011 // DT_LOOS + 4 #define DT_ANDROID_RELASZ 0x60000012 // DT_LOOS + 5 -/* TODO: upstream these to FreeBSD? */ +/* TODO: upstreamed to FreeBSD as https://github.com/freebsd/freebsd-src/pull/1141/. */ #define DT_AARCH64_MEMTAG_MODE 0x70000009 #define DT_AARCH64_MEMTAG_HEAP 0x7000000b #define DT_AARCH64_MEMTAG_STACK 0x7000000c @@ -270,8 +270,10 @@ typedef Elf64_Xword Elf64_Relr; #define R_ARM_TLS_DESC 13 #define R_ARM_IRELATIVE 160 -/* https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#relocations */ -/* TODO: upstream these to FreeBSD? */ +/* FreeBSD is missing these, found in + * https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#relocations + * so I've sent https://github.com/freebsd/freebsd-src/pull/1141 upstream. + */ #define R_RISCV_TLSDESC 12 #define R_RISCV_PLT32 59 #define R_RISCV_SET_ULEB128 60 @@ -281,5 +283,11 @@ typedef Elf64_Xword Elf64_Relr; #define R_RISCV_TLSDESC_ADD_LO12 64 #define R_RISCV_TLSDESC_CALL 65 -/* BSD spells this slightly differently to Linux. */ +/* FreeBSD spells this slightly differently to Linux. Linux is correct according to + * https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#file-header + * so I've sent https://github.com/freebsd/freebsd-src/pull/1148 upstream. + */ +#define EF_RISCV_FLOAT_ABI EF_RISCV_FLOAT_ABI_MASK + +/* FreeBSD spells this slightly differently to Linux. */ #define R_X86_64_JUMP_SLOT R_X86_64_JMP_SLOT