gold linker support for shared libraries on powerpc

Hamish Macdonald Hamish.Macdonald@alcatel-lucent.com
Wed Jan 11 23:25:00 GMT 2012


On 11/01/2012 6:17 PM, Hamish Macdonald wrote:
> I see the following in the function ppc_elf_check_relocs in source 
> file elf32-ppc.c in the BFD sources.
> Perhaps something similar is needed in gold
The following patch gets me by the R_PPC_LOCAL24PC relocation in crti.o 
problem.  It ensures that the 'got' is created when it sees a global 
R_PPC_LOCAL24PC relocation.  I suspect that this ensures that the 
subsequent 'gsym->needs_dynamic_reloc' call returns false.

[hmacdona@linuxdev01 binutils-2.22]$ diff -u 
../tmp/binutils-2.22/gold/powerpc.cc gold/powerpc.cc
--- ../tmp/binutils-2.22/gold/powerpc.cc        2011-06-28 
19:12:31.000000000 -0400
+++ gold/powerpc.cc     2012-01-11 18:18:10.000000000 -0500
@@ -1518,6 +1518,10 @@
      case elfcpp::R_PPC_REL16_HI:
      case elfcpp::R_PPC_REL16_HA:
        {
+        if (r_type == elfcpp::R_PPC_LOCAL24PC) {
+          target->got_section(symtab, layout);
+        }
+
         if (gsym->needs_plt_entry())
           target->make_plt_entry(symtab, layout, gsym);
         // Make a dynamic relocation if necessary.



More information about the Binutils mailing list