binutils 2.14a 32-bit ARM PE/COFF as addends

Paul Edwards mutazilah@gmail.com
Wed May 29 14:21:28 GMT 2024


I realize binutils 2.14a is long out of support. I'm just
documenting it anyway.



The pdld author informed me that this is wrong:

[kerravon@paul-pinebook bbb]$ cat old.txt
0092E0  4C000000 BC000000 2C010000           L.......,...
[kerravon@paul-pinebook bbb]$

and it should be:

[kerravon@paul-pinebook bbb]$ cat new.txt
0092E0  00000000 70000000 E0000000           ....p.......
[kerravon@paul-pinebook bbb]$


After quite a bit of effort, I made this change:

*** coff-arm.c  27 Mar 2024 07:18:55 -0000      1.4
--- coff-arm.c  29 May 2024 05:55:28 -0000      1.7
***************
*** 160,166 ****
                 error_message)
       bfd *abfd;
       arelent *reloc_entry;
!      asymbol *symbol ATTRIBUTE_UNUSED;
       PTR data;
       asection *input_section ATTRIBUTE_UNUSED;
       bfd *output_bfd;
--- 160,166 ----
                 error_message)
       bfd *abfd;
       arelent *reloc_entry;
!      asymbol *symbol /* ATTRIBUTE_UNUSED */;
       PTR data;
       asection *input_section ATTRIBUTE_UNUSED;
       bfd *output_bfd;
***************
*** 172,177 ****
--- 172,181 ----

    diff = reloc_entry->addend;

+   /* this subtraction was added to get consistency with Visual C -
+      not sure what the ramifications are */
+   diff -= symbol->value;
+
  #define DOIT(x)                                                       \
    x = ((x & ~howto->dst_mask)                                 \
         | (((x & howto->src_mask) + diff) & howto->dst_mask))
[kerravon@paul-pinebook bbb]$


which he deemed acceptable.

I have learnt my lesson and have attached the assembler
file that I used to test.

BFN. Paul.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stdio.s
Type: application/octet-stream
Size: 169674 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20240529/45ed5d3b/attachment-0001.obj>


More information about the Binutils mailing list