mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] arm: add support for R_ARM_REL32 relocations
@ 2025-04-14 23:50 David Leonard
  2025-04-15  2:17 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: David Leonard @ 2025-04-14 23:50 UTC (permalink / raw)
  To: musl


This fixes an issue found after building libpcap.so with -Os:

   Error relocating /lib/libpcap.so.1: unsupported relocation type 3

   $ readelf -Dr  lib/libpcap.so.1.10.4 | grep R_ARM_REL32
   00019058  0000be03 R_ARM_REL32       00037044   eproto_db


---
  arch/arm/reloc.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/arch/arm/reloc.h b/arch/arm/reloc.h
index d98eb8af..d055b68c 100644
--- a/arch/arm/reloc.h
+++ b/arch/arm/reloc.h
@@ -17,6 +17,7 @@
  #define TPOFF_K 0

  #define REL_SYMBOLIC    R_ARM_ABS32
+#define REL_OFFSET32    R_ARM_REL32
  #define REL_GOT         R_ARM_GLOB_DAT
  #define REL_PLT         R_ARM_JUMP_SLOT
  #define REL_RELATIVE    R_ARM_RELATIVE
--
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [musl] [PATCH] arm: add support for R_ARM_REL32 relocations
  2025-04-14 23:50 [musl] [PATCH] arm: add support for R_ARM_REL32 relocations David Leonard
@ 2025-04-15  2:17 ` Rich Felker
  2025-04-15  4:55   ` David Leonard
  0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2025-04-15  2:17 UTC (permalink / raw)
  To: David Leonard; +Cc: musl

On Tue, Apr 15, 2025 at 09:50:37AM +1000, David Leonard wrote:
> 
> This fixes an issue found after building libpcap.so with -Os:
> 
>   Error relocating /lib/libpcap.so.1: unsupported relocation type 3
> 
>   $ readelf -Dr  lib/libpcap.so.1.10.4 | grep R_ARM_REL32
>   00019058  0000be03 R_ARM_REL32       00037044   eproto_db
> 
> 
> ---
>  arch/arm/reloc.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/reloc.h b/arch/arm/reloc.h
> index d98eb8af..d055b68c 100644
> --- a/arch/arm/reloc.h
> +++ b/arch/arm/reloc.h
> @@ -17,6 +17,7 @@
>  #define TPOFF_K 0
> 
>  #define REL_SYMBOLIC    R_ARM_ABS32
> +#define REL_OFFSET32    R_ARM_REL32
>  #define REL_GOT         R_ARM_GLOB_DAT
>  #define REL_PLT         R_ARM_JUMP_SLOT
>  #define REL_RELATIVE    R_ARM_RELATIVE
> --
> 2.43.0

Are you sure this is correct, and can you figure out how a relocation
of this type was emitted by the linker? Usually this kind of error
comes from non-PIC-compatible code getting linked into a shared
library, and adding a mapping for the reloc type may just paper over
an error that's going to make something crash later on.

Rich

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [musl] [PATCH] arm: add support for R_ARM_REL32 relocations
  2025-04-15  2:17 ` Rich Felker
@ 2025-04-15  4:55   ` David Leonard
  0 siblings, 0 replies; 3+ messages in thread
From: David Leonard @ 2025-04-15  4:55 UTC (permalink / raw)
  To: Rich Felker; +Cc: musl

On Mon, 14 Apr 2025, Rich Felker wrote:

> On Tue, Apr 15, 2025 at 09:50:37AM +1000, David Leonard wrote:
>> This fixes an issue found after building libpcap.so with -Os:
>>
>>   Error relocating /lib/libpcap.so.1: unsupported relocation type 3
>>
>>   $ readelf -Dr  lib/libpcap.so.1.10.4 | grep R_ARM_REL32
>>   00019058  0000be03 R_ARM_REL32       00037044   eproto_db

>> --- a/arch/arm/reloc.h
>> +++ b/arch/arm/reloc.h
>> @@ -17,6 +17,7 @@
>>  #define TPOFF_K 0
>>
>>  #define REL_SYMBOLIC    R_ARM_ABS32
>> +#define REL_OFFSET32    R_ARM_REL32
>>  #define REL_GOT         R_ARM_GLOB_DAT
>>  #define REL_PLT         R_ARM_JUMP_SLOT
>>  #define REL_RELATIVE    R_ARM_RELATIVE

> Are you sure this is correct, and can you figure out how a relocation
> of this type was emitted by the linker? Usually this kind of error
> comes from non-PIC-compatible code getting linked into a shared
> library, and adding a mapping for the reloc type may just paper over
> an error that's going to make something crash later on.

ucfront-gcc arm-linux-musleabi-20240415-gcc  -fvisibility=hidden
-Os -ffunction-sections -fdata-sections -fstack-protector-strong
-Wl,-z,relro,-z,now -Wl,-z,noexecstack -fPIE -pipe -fno-common
-fno-builtin -Wall  -Dlinux -D__linux__ -Dunix -DCONFIG_ACCELECON
-DOPTIMIZE_FOR_SIZE -DEMBED 
-fpic -I.  -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H  -Os
-ffunction-sections -fdata-sections -fstack-protector-strong
-Wl,-z,relro,-z,now -Wl,-z,noexecstack -fPIE -pipe -fno-common
-fno-builtin -Wall  -Dlinux -D__linux__ -Dunix -DCONFIG_ACCELECON
-DOPTIMIZE_FOR_SIZE -DEMBED
-c ./nametoaddr.c

Yes, I don't think that -fPIE should be there.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-15  4:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-14 23:50 [musl] [PATCH] arm: add support for R_ARM_REL32 relocations David Leonard
2025-04-15  2:17 ` Rich Felker
2025-04-15  4:55   ` David Leonard

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).