]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd/efl32-arm.c: Fix handling of IRELATIVE relocs.
authorWill Newton <willnewton@sourceware.org>
Tue, 28 May 2013 16:00:36 +0000 (16:00 +0000)
committerWill Newton <willnewton@sourceware.org>
Tue, 28 May 2013 16:00:36 +0000 (16:00 +0000)
bfd/ChangeLog:

2013-05-28  Will Newton  <will.newton@linaro.org>

* elf32-arm.c (elf32_arm_populate_plt_entry): Call
elf32_arm_add_dynreloc when emitting R_ARM_IRELATIVE relocs.

ld/testsuite/ChangeLog:

2013-05-28  Will Newton  <will.newton@linaro.org>

* ld-arm/arm-elf.exp: Add IFUNC test 17.
* ld-arm/ifunc-17.dd: New file.
* ld-arm/ifunc-17.gd: Likewise.
* ld-arm/ifunc-17.rd: Likewise.
* ld-arm/ifunc-17.s: Likweise.
* ld-arm/ifunc-1.rd: Reorder relocs to match linker output.
* ld-arm/ifunc-2.rd: Likewise.
* ld-arm/ifunc-5.rd: Likewise.
* ld-arm/ifunc-6.rd: Likewise.

13 files changed:
bfd/ChangeLog
bfd/doc/bfd.info
bfd/elf32-arm.c
ld/testsuite/ChangeLog
ld/testsuite/ld-arm/arm-elf.exp
ld/testsuite/ld-arm/ifunc-1.rd
ld/testsuite/ld-arm/ifunc-17.dd [new file with mode: 0644]
ld/testsuite/ld-arm/ifunc-17.gd [new file with mode: 0644]
ld/testsuite/ld-arm/ifunc-17.rd [new file with mode: 0644]
ld/testsuite/ld-arm/ifunc-17.s [new file with mode: 0644]
ld/testsuite/ld-arm/ifunc-2.rd
ld/testsuite/ld-arm/ifunc-5.rd
ld/testsuite/ld-arm/ifunc-6.rd

index 2074173340b4e0c2d289018cfbebc631dacc3734..45d1919a6165e3291a249ae60640c72a4d396877 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-28  Will Newton  <will.newton@linaro.org>
+
+       * elf32-arm.c (elf32_arm_populate_plt_entry): Call
+       elf32_arm_add_dynreloc when emitting R_ARM_IRELATIVE relocs.
+
 2013-04-24  Roland McGrath  <mcgrathr@google.com>
 
        * elf32-arm.c (elf32_arm_allocate_plt_entry): If HTAB->nacl_p,
index ce01eda3b0815ec47e38e5ddfe4a9d35c562ef6c..7e11660d771bfd4cc792c8d731fab25abd5a9182 100644 (file)
@@ -1,4 +1,4 @@
-This is bfd.info, produced by makeinfo version 4.8 from bfd.texinfo.
+This is bfd.info, produced by makeinfo version 4.13 from bfd.texinfo.
 
 INFO-DIR-SECTION Software development
 START-INFO-DIR-ENTRY
@@ -8434,9 +8434,9 @@ The linker proper will call the `_bfd_link_add_symbols' entry point for
 each object file or archive which is to be linked (typically these are
 the files named on the command line, but some may also come from the
 linker script).  The entry point is responsible for examining the file.
-For an object file, BFD must add any relevant symbol information to
-the hash table.  For an archive, BFD must determine which elements of
-the archive should be used and adding them to the link.
+For an object file, BFD must add any relevant symbol information to the
+hash table.  For an archive, BFD must determine which elements of the
+archive should be used and adding them to the link.
 
    The a.out version of this entry point is
 `NAME(aout,link_add_symbols)'.
@@ -12742,67 +12742,67 @@ BFD Index
 
 \1f
 Tag Table:
-Node: Top\7f1089
-Node: Overview\7f1428
-Node: History\7f2479
-Node: How It Works\7f3425
-Node: What BFD Version 2 Can Do\7f4968
-Node: BFD information loss\7f6283
-Node: Canonical format\7f8815
-Node: BFD front end\7f13187
-Node: Memory Usage\7f47553
-Node: Initialization\7f48781
-Node: Sections\7f49240
-Node: Section Input\7f49723
-Node: Section Output\7f51088
-Node: typedef asection\7f53574
-Node: section prototypes\7f78781
-Node: Symbols\7f89038
-Node: Reading Symbols\7f90633
-Node: Writing Symbols\7f91740
-Node: Mini Symbols\7f93481
-Node: typedef asymbol\7f94455
-Node: symbol handling functions\7f100514
-Node: Archives\7f105856
-Node: Formats\7f109582
-Node: Relocations\7f112530
-Node: typedef arelent\7f113257
-Node: howto manager\7f128893
-Node: Core Files\7f227332
-Node: Targets\7f229370
-Node: bfd_target\7f231340
-Node: Architectures\7f254562
-Node: Opening and Closing\7f280438
-Node: Internal\7f291957
-Node: File Caching\7f298302
-Node: Linker Functions\7f300216
-Node: Creating a Linker Hash Table\7f301889
-Node: Adding Symbols to the Hash Table\7f303627
-Node: Differing file formats\7f304527
-Node: Adding symbols from an object file\7f306252
-Node: Adding symbols from an archive\7f308403
-Node: Performing the Final Link\7f311332
-Node: Information provided by the linker\7f312574
-Node: Relocating the section contents\7f313728
-Node: Writing the symbol table\7f315479
-Node: Hash Tables\7f319865
-Node: Creating and Freeing a Hash Table\7f321063
-Node: Looking Up or Entering a String\7f322313
-Node: Traversing a Hash Table\7f323566
-Node: Deriving a New Hash Table Type\7f324355
-Node: Define the Derived Structures\7f325421
-Node: Write the Derived Creation Routine\7f326502
-Node: Write Other Derived Routines\7f329126
-Node: BFD back ends\7f330441
-Node: What to Put Where\7f330711
-Node: aout\7f330891
-Node: coff\7f337209
-Node: elf\7f365642
-Node: mmo\7f366043
-Node: File layout\7f366971
-Node: Symbol-table\7f372618
-Node: mmo section mapping\7f376387
-Node: GNU Free Documentation License\7f380039
-Node: BFD Index\7f405122
+Node: Top\7f1090
+Node: Overview\7f1429
+Node: History\7f2480
+Node: How It Works\7f3426
+Node: What BFD Version 2 Can Do\7f4969
+Node: BFD information loss\7f6284
+Node: Canonical format\7f8816
+Node: BFD front end\7f13188
+Node: Memory Usage\7f47554
+Node: Initialization\7f48782
+Node: Sections\7f49241
+Node: Section Input\7f49724
+Node: Section Output\7f51089
+Node: typedef asection\7f53575
+Node: section prototypes\7f78782
+Node: Symbols\7f89039
+Node: Reading Symbols\7f90634
+Node: Writing Symbols\7f91741
+Node: Mini Symbols\7f93482
+Node: typedef asymbol\7f94456
+Node: symbol handling functions\7f100515
+Node: Archives\7f105857
+Node: Formats\7f109583
+Node: Relocations\7f112531
+Node: typedef arelent\7f113258
+Node: howto manager\7f128894
+Node: Core Files\7f227333
+Node: Targets\7f229371
+Node: bfd_target\7f231341
+Node: Architectures\7f254563
+Node: Opening and Closing\7f280439
+Node: Internal\7f291958
+Node: File Caching\7f298303
+Node: Linker Functions\7f300217
+Node: Creating a Linker Hash Table\7f301890
+Node: Adding Symbols to the Hash Table\7f303628
+Node: Differing file formats\7f304528
+Node: Adding symbols from an object file\7f306253
+Node: Adding symbols from an archive\7f308404
+Node: Performing the Final Link\7f311333
+Node: Information provided by the linker\7f312575
+Node: Relocating the section contents\7f313729
+Node: Writing the symbol table\7f315480
+Node: Hash Tables\7f319866
+Node: Creating and Freeing a Hash Table\7f321064
+Node: Looking Up or Entering a String\7f322314
+Node: Traversing a Hash Table\7f323567
+Node: Deriving a New Hash Table Type\7f324356
+Node: Define the Derived Structures\7f325422
+Node: Write the Derived Creation Routine\7f326503
+Node: Write Other Derived Routines\7f329127
+Node: BFD back ends\7f330442
+Node: What to Put Where\7f330712
+Node: aout\7f330892
+Node: coff\7f337210
+Node: elf\7f365643
+Node: mmo\7f366044
+Node: File layout\7f366972
+Node: Symbol-table\7f372619
+Node: mmo section mapping\7f376388
+Node: GNU Free Documentation License\7f380040
+Node: BFD Index\7f405123
 \1f
 End Tag Table
index 22aabc8971f227635083d5198553ceeb927127e4..7e87d707ffeb583ed8607edea81777734ad0f9e1 100644 (file)
@@ -7734,8 +7734,13 @@ elf32_arm_populate_plt_entry (bfd *output_bfd, struct bfd_link_info *info,
                  sgot->contents + got_offset);
     }
 
-  loc = srel->contents + plt_index * RELOC_SIZE (htab);
-  SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
+  if (dynindx == -1)
+    elf32_arm_add_dynreloc (output_bfd, info, srel, &rel);
+  else
+    {
+      loc = srel->contents + plt_index * RELOC_SIZE (htab);
+      SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
+    }
 }
 
 /* Some relocations map to different relocations depending on the
index 6d516e08a42b63b2cce969ce6df05b8677c988e7..4cb34d323da70b89d3c1ba87d0451f885744d0c7 100644 (file)
@@ -1,3 +1,15 @@
+2013-05-28  Will Newton  <will.newton@linaro.org>
+
+       * ld-arm/arm-elf.exp: Add IFUNC test 17.
+       * ld-arm/ifunc-17.dd: New file.
+       * ld-arm/ifunc-17.gd: Likewise.
+       * ld-arm/ifunc-17.rd: Likewise.
+       * ld-arm/ifunc-17.s: Likweise.
+       * ld-arm/ifunc-1.rd: Reorder relocs to match linker output.
+       * ld-arm/ifunc-2.rd: Likewise.
+       * ld-arm/ifunc-5.rd: Likewise.
+       * ld-arm/ifunc-6.rd: Likewise.
+
 2013-03-05  Alan Modra  <amodra@gmail.com>
 
        * ld-scripts/rgn-at6.s, * ld-scripts/rgn-at6.t, * ld-scripts/rgn-at6.d,
index 8e15ffe5087790c5d116029c31df3cd2b96d4155..91b06571deed955ac80fae07a1489384fd007a01 100644 (file)
@@ -433,6 +433,11 @@ set armelftests_nonacl {
       {objdump {-s -j.data -j.got} ifunc-16.gd}
       {readelf -r ifunc-16.rd}}
      "ifunc-16"}
+    {"IFUNC test 17" "-T ifunc-static.ld" "" {ifunc-17.s}
+     {{objdump -d ifunc-17.dd}
+      {objdump {-s -j.data -j.got} ifunc-17.gd}
+      {readelf -r ifunc-17.rd}}
+     "ifunc-17"}
 }
 
 run_ld_link_tests $armelftests_common
index 75e6d700bc0e0ef6f4a6740c80f7cfad99400b77..264412312f68eb89c401777dcc087cb0efc4cbe4 100644 (file)
@@ -4,5 +4,5 @@ There is no dynamic section in this file\.
 Relocation section '\.rel\.dyn' at offset 0x8000 contains 3 entries:
  Offset     Info    Type            Sym\.Value  Sym\. Name
 0001100c  ......a0 R_ARM_IRELATIVE  
-00011010  ......a0 R_ARM_IRELATIVE  
 00011014  ......a0 R_ARM_IRELATIVE  
+00011010  ......a0 R_ARM_IRELATIVE  
diff --git a/ld/testsuite/ld-arm/ifunc-17.dd b/ld/testsuite/ld-arm/ifunc-17.dd
new file mode 100644 (file)
index 0000000..ee5cd05
--- /dev/null
@@ -0,0 +1,25 @@
+
+.*
+
+
+Disassembly of section \.iplt:
+
+00009000 <.iplt>:
+#------------------------------------------------------------------------------
+#------ appfunc1's .iplt entry
+#------------------------------------------------------------------------------
+    9000:      e28fc600        add     ip, pc, #0, 12
+    9004:      e28cca08        add     ip, ip, #8, 20  ; 0x8000
+    9008:      e5bcf004        ldr     pc, \[ip, #4\]!
+
+Disassembly of section \.text:
+
+0000a000 <appfunc1>:
+    a000:      46f7            mov     pc, lr
+
+0000a002 <appfunc2>:
+    a002:      46f7            mov     pc, lr
+
+0000a004 <_start>:
+    a004:      f7fe effc       blx     9000 <appfunc1-0x1000>
+    a008:      00000010        \.word  0x00000010
diff --git a/ld/testsuite/ld-arm/ifunc-17.gd b/ld/testsuite/ld-arm/ifunc-17.gd
new file mode 100644 (file)
index 0000000..dadfc9e
--- /dev/null
@@ -0,0 +1,10 @@
+
+.*
+
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 0001100c: 0xa001 (appfunc1)
+#------ 00011010: 0xa003 (appfunc2)
+#------------------------------------------------------------------------------
+ 11000 00000000 00000000 00000000 01a00000  .*
+ 11010 03a00000                             .*
diff --git a/ld/testsuite/ld-arm/ifunc-17.rd b/ld/testsuite/ld-arm/ifunc-17.rd
new file mode 100644 (file)
index 0000000..b167f45
--- /dev/null
@@ -0,0 +1,5 @@
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 2 entries:
+ Offset     Info    Type            Sym\.Value  Sym\. Name
+0001100c  ......a0 R_ARM_IRELATIVE  
+00011010  ......a0 R_ARM_IRELATIVE  
diff --git a/ld/testsuite/ld-arm/ifunc-17.s b/ld/testsuite/ld-arm/ifunc-17.s
new file mode 100644 (file)
index 0000000..75c4c56
--- /dev/null
@@ -0,0 +1,24 @@
+       .syntax unified
+       .arch armv6t2
+
+       .global appfunc1
+       .type   appfunc1,%gnu_indirect_function
+       .thumb
+appfunc1:
+       mov     pc,lr
+       .size   appfunc1,.-appfunc1
+
+       .global appfunc2
+       .type   appfunc2,%gnu_indirect_function
+       .thumb
+appfunc2:
+       mov     pc,lr
+       .size   appfunc2,.-appfunc2
+
+       .global _start
+       .type _start,%function
+       .thumb
+_start:
+       bl      appfunc1(PLT)
+       .word   appfunc2(GOT)
+       .size   _start,.-_start
index 92b000a86f59cefc5caa459760c724b4e6801e0a..7bbabf421f3686c5f32d4894a4ff0644c431a320 100644 (file)
@@ -5,9 +5,9 @@ Relocation section '\.rel\.dyn' at offset 0x8000 contains 8 entries:
  Offset     Info    Type            Sym\.Value  Sym\. Name
 0001100c  ......a0 R_ARM_IRELATIVE  
 00011010  ......a0 R_ARM_IRELATIVE  
+00011020  ......a0 R_ARM_IRELATIVE  
+00011028  ......a0 R_ARM_IRELATIVE  
 00011014  ......a0 R_ARM_IRELATIVE  
 00011018  ......a0 R_ARM_IRELATIVE  
 0001101c  ......a0 R_ARM_IRELATIVE  
-00011020  ......a0 R_ARM_IRELATIVE  
 00011024  ......a0 R_ARM_IRELATIVE  
-00011028  ......a0 R_ARM_IRELATIVE  
index 75e6d700bc0e0ef6f4a6740c80f7cfad99400b77..264412312f68eb89c401777dcc087cb0efc4cbe4 100644 (file)
@@ -4,5 +4,5 @@ There is no dynamic section in this file\.
 Relocation section '\.rel\.dyn' at offset 0x8000 contains 3 entries:
  Offset     Info    Type            Sym\.Value  Sym\. Name
 0001100c  ......a0 R_ARM_IRELATIVE  
-00011010  ......a0 R_ARM_IRELATIVE  
 00011014  ......a0 R_ARM_IRELATIVE  
+00011010  ......a0 R_ARM_IRELATIVE  
index 0fbfec5905dda5df06b64bc24ec2ee9d68f0e0ae..04c18a926f616f91b4867e8deb430e2a397deddd 100644 (file)
@@ -3,7 +3,7 @@ There is no dynamic section in this file\.
 
 Relocation section '\.rel\.dyn' at offset 0x8000 contains 4 entries:
  Offset     Info    Type            Sym\.Value  Sym\. Name
-0001100c  ......a0 R_ARM_IRELATIVE  
+00011018  ......a0 R_ARM_IRELATIVE  
 00011010  ......a0 R_ARM_IRELATIVE  
+0001100c  ......a0 R_ARM_IRELATIVE  
 00011014  ......a0 R_ARM_IRELATIVE  
-00011018  ......a0 R_ARM_IRELATIVE