[GOLD][PATCH] Added support for the ARM relocations: R_ARM_THM_PC8/PC12, R_ARM_THM_ALU_PREL_11_0

Viktor Kutuzov vkutuzov@accesssoftek.com
Fri Jan 29 23:14:00 GMT 2010


>The same problem happens in the R_ARM_THM_PC12 as well.

The thm_pc12 method examines an absolute value from 'val' for the overflow. That should be correct.
Ok. I sent an updated patch for these relocations.

-Viktor.

________________________________________
From: Doug Kwan ($Bop?6y~(B) [dougkwan@google.com]
Sent: Friday, January 29, 2010 2:27 PM
To: Viktor Kutuzov
Cc: Ian Lance Taylor; binutils@sourceware.org
Subject: Re: [GOLD][PATCH] Added support for the ARM relocations:       R_ARM_THM_PC8/PC12, R_ARM_THM_ALU_PREL_11_0

+    int32_t x = (psymval->value(object, addend) - (address & 0xfffffffc));
+    Reltype val = abs(x) & 0x03fc;
+    insn = (insn & 0xff00) | (val >> 2);
+
+    elfcpp::Swap<16, big_endian>::writeval(wv, insn);
+    return ((x > 0x03fc)
+           ? This::STATUS_OVERFLOW
+           : This::STATUS_OKAY);

Please not that x is signed.  Your overflow check fails if x is
negative.    The same problem happens in the R_ARM_THM_PC12 as well.

-Doug


2010/1/29 Viktor Kutuzov <vkutuzov@accesssoftek.com>:
> Hello everyone,
>
> Please find attached patch that adds a support for the ARM relocations: R_ARM_THM_PC8, R_ARM_THM_PC12 and R_ARM_THM_ALU_PREL_11_0.
>
> Best regards,
> Viktor.
>
> * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8, R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
> (Arm_relocate_functions::thm_alu11): New Method.
> (Arm_relocate_functions::thm_pc8): New Method.
> (Arm_relocate_functions::thm_pc12): New Method.
> (Target_arm<big_endian>::Scan::local): Handle the relocations.
> (Target_arm<big_endian>::Scan::global): Likewise.
> (Target_arm<big_endian>::Relocate::relocate): Likewise.
> (Target_arm<big_endian>::Relocatable_size_for_reloc::get_size_for_reloc): Likewise.



More information about the Binutils mailing list