gcc and -fPIC

Andreas Schwab schwab@suse.de
Tue Oct 19 13:48:00 GMT 2004


Alan Modra <amodra@bigpond.net.au> writes:

> On Mon, Oct 18, 2004 at 10:11:50PM +0200, Andreas Schwab wrote:
>> -      addr = bed->plt_sym_val (i, plt, p);
>> +      addr = bed->plt_sym_val (abfd, i, plt, p);
>
> There's no need to pass abfd here.  You can use plt->owner in your
> target function.

Hmm, I tried that first and got a segfault, but I can't reproduce that any
more.

Andreas.

2004-10-19  Andreas Schwab  <schwab@suse.de>

	* elf32-m68k.c (elf_m68k_plt_sym_val): New fuction.
	(elf_backend_plt_sym_val): Define.

Index: bfd/elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.68
diff -u -p -a -u -p -a -r1.68 bfd/elf32-m68k.c
--- bfd/elf32-m68k.c	17 Sep 2004 07:14:27 -0000	1.68
+++ bfd/elf32-m68k.c	19 Oct 2004 13:33:52 -0000
@@ -2207,6 +2207,18 @@ elf32_m68k_reloc_type_class (rela)
     }
 }
 
+/* Return address for Ith PLT stub in section PLT, for relocation REL
+   or (bfd_vma) -1 if it should not be included.  */
+
+static bfd_vma
+elf_m68k_plt_sym_val (bfd_vma i, const asection *plt,
+		      const arelent *rel ATTRIBUTE_UNUSED)
+{
+  if (CPU32_FLAG (plt->owner))
+    return plt->vma + (i + 1) * PLT_CPU32_ENTRY_SIZE;
+  return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
+}
+
 #define TARGET_BIG_SYM			bfd_elf32_m68k_vec
 #define TARGET_BIG_NAME			"elf32-m68k"
 #define ELF_MACHINE_CODE		EM_68K
@@ -2236,6 +2248,7 @@ elf32_m68k_reloc_type_class (rela)
 #define bfd_elf32_bfd_print_private_bfd_data \
                                         elf32_m68k_print_private_bfd_data
 #define elf_backend_reloc_type_class	elf32_m68k_reloc_type_class
+#define elf_backend_plt_sym_val		elf_m68k_plt_sym_val
 
 #define elf_backend_can_gc_sections 1
 #define elf_backend_can_refcount 1

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Binutils mailing list