* [PATCH] arm: Remove nested functionf rom relocate_pc24
@ 2022-08-12 12:40 Wilco Dijkstra
0 siblings, 0 replies; 3+ messages in thread
From: Wilco Dijkstra @ 2022-08-12 12:40 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: 'GNU C Library'
Hi Adhemerval,
> Checked on arm-linux-gnueabihf.
That looks good to me.
Cheers,
Wilco
---
sysdeps/arm/dl-machine.h | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 4e78d8fb0e..b0521c1549 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -227,6 +227,16 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
#define ARCH_LA_PLTEXIT arm_gnu_pltexit
#ifdef RESOLVE_MAP
+/* Set NEW_VALUE based on V, and return true iff it overflows 24 bits. */
+static inline bool set_new_value (Elf32_Addr *new_value, Elf32_Addr v,
+ Elf32_Addr *const reloc_addr,
+ Elf32_Sword addend)
+{
+ *new_value = v + addend - (Elf32_Addr) reloc_addr;
+ Elf32_Addr topbits = *new_value & 0xfe000000;
+ return topbits != 0xfe000000 && topbits != 0x00000000;
+}
+
/* Handle a PC24 reloc, including the out-of-range case. */
static void
relocate_pc24 (struct link_map *map, Elf32_Addr value,
@@ -234,15 +244,7 @@ relocate_pc24 (struct link_map *map, Elf32_Addr value,
{
Elf32_Addr new_value;
- /* Set NEW_VALUE based on V, and return true iff it overflows 24 bits. */
- inline bool set_new_value (Elf32_Addr v)
- {
- new_value = v + addend - (Elf32_Addr) reloc_addr;
- Elf32_Addr topbits = new_value & 0xfe000000;
- return topbits != 0xfe000000 && topbits != 0x00000000;
- }
-
- if (set_new_value (value))
+ if (set_new_value (&new_value, value, reloc_addr, addend))
{
/* The PC-relative address doesn't fit in 24 bits! */
@@ -271,7 +273,8 @@ relocate_pc24 (struct link_map *map, Elf32_Addr value,
fix_offset = 0;
}
- if (set_new_value ((Elf32_Addr) fix_address))
+ if (set_new_value (&new_value, (Elf32_Addr) fix_address, reloc_addr,
+ addend))
_dl_signal_error (0, map->l_name, NULL,
"R_ARM_PC24 relocation out of range");
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] arm: Remove nested functionf rom relocate_pc24
2022-08-10 20:14 Adhemerval Zanella
@ 2022-08-10 20:22 ` Florian Weimer
0 siblings, 0 replies; 3+ messages in thread
From: Florian Weimer @ 2022-08-10 20:22 UTC (permalink / raw)
To: Adhemerval Zanella via Libc-alpha
* Adhemerval Zanella via Libc-alpha:
> Checked on arm-linux-gnueabihf.
Typo in commit subject: “function[ f]rom”
Change itself looks okay, but I'm not an Arm maintainer.
Thanks,
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] arm: Remove nested functionf rom relocate_pc24
@ 2022-08-10 20:14 Adhemerval Zanella
2022-08-10 20:22 ` Florian Weimer
0 siblings, 1 reply; 3+ messages in thread
From: Adhemerval Zanella @ 2022-08-10 20:14 UTC (permalink / raw)
To: libc-alpha
Checked on arm-linux-gnueabihf.
---
sysdeps/arm/dl-machine.h | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 4e78d8fb0e..b0521c1549 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -227,6 +227,16 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
#define ARCH_LA_PLTEXIT arm_gnu_pltexit
#ifdef RESOLVE_MAP
+/* Set NEW_VALUE based on V, and return true iff it overflows 24 bits. */
+static inline bool set_new_value (Elf32_Addr *new_value, Elf32_Addr v,
+ Elf32_Addr *const reloc_addr,
+ Elf32_Sword addend)
+{
+ *new_value = v + addend - (Elf32_Addr) reloc_addr;
+ Elf32_Addr topbits = *new_value & 0xfe000000;
+ return topbits != 0xfe000000 && topbits != 0x00000000;
+}
+
/* Handle a PC24 reloc, including the out-of-range case. */
static void
relocate_pc24 (struct link_map *map, Elf32_Addr value,
@@ -234,15 +244,7 @@ relocate_pc24 (struct link_map *map, Elf32_Addr value,
{
Elf32_Addr new_value;
- /* Set NEW_VALUE based on V, and return true iff it overflows 24 bits. */
- inline bool set_new_value (Elf32_Addr v)
- {
- new_value = v + addend - (Elf32_Addr) reloc_addr;
- Elf32_Addr topbits = new_value & 0xfe000000;
- return topbits != 0xfe000000 && topbits != 0x00000000;
- }
-
- if (set_new_value (value))
+ if (set_new_value (&new_value, value, reloc_addr, addend))
{
/* The PC-relative address doesn't fit in 24 bits! */
@@ -271,7 +273,8 @@ relocate_pc24 (struct link_map *map, Elf32_Addr value,
fix_offset = 0;
}
- if (set_new_value ((Elf32_Addr) fix_address))
+ if (set_new_value (&new_value, (Elf32_Addr) fix_address, reloc_addr,
+ addend))
_dl_signal_error (0, map->l_name, NULL,
"R_ARM_PC24 relocation out of range");
}
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-12 12:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-12 12:40 [PATCH] arm: Remove nested functionf rom relocate_pc24 Wilco Dijkstra
-- strict thread matches above, loose matches on Subject: below --
2022-08-10 20:14 Adhemerval Zanella
2022-08-10 20:22 ` Florian Weimer
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 read-only IMAP folder(s) and NNTP newsgroup(s).