This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to get a patch into Bin utils


What is the process for submitting a patch for bin utils and getting
it applied to the main source tree ?

I have a patch for a bug that I have submitted to bugzilla at

Problem: ld does not generate the correct code for R_ARM_THM_ALU_PREL
relocation under ARM according to the ARM ABI. Tracked it down and
fixed it. After the relocation, the Thumb bit for symbols that point
to thumb code. I.e. symbols of type STT_FUNC with the lsb bit set to
1, are not set.

This relocation is not normally generated by GCC for function pointers
which is why I guess it has gone undetected for so long, though I
spotted a reference for a similar complaint on launchpad dated 2015.
However I recently needed to link GCC against IAR generated  libaries
and the linked code kept on generating Hard faults on a Cortex M4
until I tracked down the problem and patched. The patch is really
simple (2 lines) and in the style of the changes made on the other
relocatables that require setting of the thumb bit,

I created a bug 21458 at and it showed up on the
appropriate mailing list and I submitted a patch. I have verified and
checked that the patch is generating correct code. Showed the
disassembly output from before and after applying the patch as part of
the patch submission.

What do I do now to get the patch reviewed and added. Is there any
copyright assignment I need to sign to FSF?

>From 962abfea5b59dc8ec7f5dc0e1c38704aac0094e3 Mon Sep 17 00:00:00 2001
From: Andrew Goedhart <>
Date: Thu, 4 May 2017 02:17:54 +0200
Subject: [PATCH] Fix R_ARM_THM_ALU_PREL relocation to confirm to ARM elf abi
  set thumb bit on branch to thumb code

 bfd/elf32-arm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 434649f..9acd9c7 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -10508,6 +10508,10 @@ elf32_arm_final_link_relocate
(reloc_howto_type *           howto,

  value = relocation;

+ if ( branch_type == ST_BRANCH_TO_THUMB){
+   value |= 1;
+ }
  if (value >= 0x1000)
    return bfd_reloc_overflow;


Andrew Goedhart

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]