about summary refs log tree commit diff
path: root/elf/elf.h
diff options
context:
space:
mode:
authorHsiangkai Wang <kai.wang@sifive.com>2023-03-15 00:25:12 +0800
committerPalmer Dabbelt <palmer@rivosinc.com>2023-04-28 07:02:42 -0700
commit117e8b341c5c0ace8d65feeef136fececb3fdc9c (patch)
tree38aa30211c5aee3e6a1f15d3fec86bf18508608c /elf/elf.h
parent2fa7fd1af733e323fa90d059e2ba60ec965d2cbb (diff)
downloadglibc-117e8b341c5c0ace8d65feeef136fececb3fdc9c.tar.gz
glibc-117e8b341c5c0ace8d65feeef136fececb3fdc9c.tar.xz
glibc-117e8b341c5c0ace8d65feeef136fececb3fdc9c.zip
riscv: Resolve symbols directly for symbols with STO_RISCV_VARIANT_CC.
In some cases, we do not want to go through the resolver for function
calls. For example, functions with vector arguments will use vector
registers to pass arguments. In the resolver, we do not save/restore the
vector argument registers for lazy binding efficiency. To avoid ruining
the vector arguments, functions with vector arguments will not go
through the resolver.

To achieve the goal, we will annotate the function symbols with
STO_RISCV_VARIANT_CC flag and add DT_RISCV_VARIANT_CC tag in the dynamic
section. In the first pass on PLT relocations, we do not set up to call
_dl_runtime_resolve. Instead, we resolve the functions directly.

Signed-off-by: Hsiangkai Wang <kai.wang@sifive.com>
Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Link: https://inbox.sourceware.org/libc-alpha/20230314162512.35802-1-kito.cheng@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'elf/elf.h')
-rw-r--r--elf/elf.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/elf/elf.h b/elf/elf.h
index 94ca23c1bb..4f65b5a32d 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -3933,6 +3933,13 @@ enum
 
 #define R_TILEGX_NUM		130
 
+/* RISC-V specific values for the Dyn d_tag field.  */
+#define DT_RISCV_VARIANT_CC	(DT_LOPROC + 1)
+#define DT_RISCV_NUM		2
+
+/* RISC-V specific values for the st_other field.  */
+#define STO_RISCV_VARIANT_CC 0x80
+
 /* RISC-V ELF Flags */
 #define EF_RISCV_RVC 			0x0001
 #define EF_RISCV_FLOAT_ABI 		0x0006