From 59efc3a839fbdd618a7494d8184a97b250ded070 Mon Sep 17 00:00:00 2001 From: Brandon Bergren Date: Thu, 19 Dec 2019 22:35:16 +0000 Subject: [PATCH] [PowerPC] Only move linker sets to .data on ELFv1 In r268055, powerpc64 was special cased regarding linker sets to not mark the function pointer as 'const'. This appears to have been done to ensure the compiler generates the function descriptors correctly. When non-const, the function descriptors will end up in the .data.rel.local section, and the linker set symbols will get relocations pointing to them there. Since function pointers on ELFv2 are "just" pointers like other platforms, we can leave them const like they are on every other platform. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22796 --- sys/sys/linker_set.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/sys/linker_set.h b/sys/sys/linker_set.h index 783cf9d615e8..6169a3499dad 100644 --- a/sys/sys/linker_set.h +++ b/sys/sys/linker_set.h @@ -42,8 +42,11 @@ * For ELF, this is done by constructing a separate segment for each set. */ -#if defined(__powerpc64__) +#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) /* + * ELFv1 pointers to functions are actaully pointers to function + * descriptors. + * * Move the symbol pointer from ".text" to ".data" segment, to make * the GCC compiler happy: */