public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [committed] Make is_ppc_elf_target return true for VxWorks files
@ 2006-03-02  9:50 Richard Sandiford
  2006-03-02 11:29 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2006-03-02  9:50 UTC (permalink / raw)
  To: binutils

is_ppc_elf_target returns false for bfd_elf32_powerpc_vxworks_vec,
which causes size_dynamic_sections to skip local dynamic relocations
for VxWorks input files.

This patch adds the missing condition and makes the VxWorks testcases
check for this sort of thing.  Installed as obvious after testing on
i586-vxworks and powerpc-vxworks.

FWIW, I think this is the last VxWorks bugfix I have in the pipeline.

Richard


bfd/
	* elf32-ppc.c (is_ppc_elf_target): Return true if the target is
	bfd_elf32_powerpc_vxworks_vec.

ld/testsuite/
	* ld-i386/vxworks1.ld (.data): New section.
	* ld-i386/vxworks1-lib.s: Add a pointer to a local symbol.
	* ld-i386/vxworks1-lib.rd: Test for the associated reloc.
	* ld-powerpc/vxworks1.ld (.data): New section.
	* ld-powerpc/vxworks1-lib.s: Add a pointer to a local symbol.
	* ld-powerpc/vxworks1-lib.rd: Test for the associated reloc.

diff -udprN ../src.1/bfd/elf32-ppc.c ./bfd/elf32-ppc.c
--- ./bfd/elf32-ppc.c	2006-03-02 08:55:23.000000000 +0000
+++ ./bfd/elf32-ppc.c	2006-03-02 09:25:25.000000000 +0000
@@ -2679,9 +2679,12 @@ static bfd_boolean
 is_ppc_elf_target (const struct bfd_target *targ)
 {
   extern const bfd_target bfd_elf32_powerpc_vec;
+  extern const bfd_target bfd_elf32_powerpc_vxworks_vec;
   extern const bfd_target bfd_elf32_powerpcle_vec;
 
-  return targ == &bfd_elf32_powerpc_vec || targ == &bfd_elf32_powerpcle_vec;
+  return (targ == &bfd_elf32_powerpc_vec
+	  || targ == &bfd_elf32_powerpc_vxworks_vec
+	  || targ == &bfd_elf32_powerpcle_vec);
 }
 
 /* Hook called by the linker routine which adds symbols from an object
diff -udprN ../src.1/ld/testsuite/ld-i386/vxworks1.ld ./ld/testsuite/ld-i386/vxworks1.ld
--- ./ld/testsuite/ld-i386/vxworks1.ld	2006-03-02 08:53:19.000000000 +0000
+++ ./ld/testsuite/ld-i386/vxworks1.ld	2006-03-02 09:29:43.000000000 +0000
@@ -24,4 +24,7 @@ SECTIONS
 
   . = ALIGN (0x400);
   .bss : { *(.bss) *(.dynbss) }
+
+  . = ALIGN (0x400);
+  .data : { *(.data) }
 }
diff -udprN ../src.1/ld/testsuite/ld-i386/vxworks1-lib.rd ./ld/testsuite/ld-i386/vxworks1-lib.rd
--- ./ld/testsuite/ld-i386/vxworks1-lib.rd	2006-03-02 08:53:19.000000000 +0000
+++ ./ld/testsuite/ld-i386/vxworks1-lib.rd	2006-03-02 09:33:02.000000000 +0000
@@ -4,8 +4,9 @@ Relocation section '\.rel\.plt' at offse
 0008140c  .*07 R_386_JUMP_SLOT   00000000   sexternal
 00081410  .*07 R_386_JUMP_SLOT   00080c27   sglobal
 
-Relocation section '\.rel\.dyn' at offset .* contains 3 entries:
+Relocation section '\.rel\.dyn' at offset .* contains 4 entries:
  Offset     Info    Type            Sym\.Value  Sym\. Name
+00081c00  00000008 R_386_RELATIVE *
 00080c03  .*01 R_386_32          00000000   __GOTT_BASE__
 00080c09  .*01 R_386_32          00000000   __GOTT_INDEX__
 00081414  .*06 R_386_GLOB_DAT    00081800   x
diff -udprN ../src.1/ld/testsuite/ld-i386/vxworks1-lib.s ./ld/testsuite/ld-i386/vxworks1-lib.s
--- ./ld/testsuite/ld-i386/vxworks1-lib.s	2006-02-28 07:16:22.000000000 +0000
+++ ./ld/testsuite/ld-i386/vxworks1-lib.s	2006-03-02 09:39:51.000000000 +0000
@@ -25,4 +25,7 @@ sglobal:
 	ret
 	.size	sglobal, .-sglobal
 
+	.data
+	.4byte	slocal
+
 	.comm	x,4,4
diff -udprN ../src.1/ld/testsuite/ld-powerpc/vxworks1.ld ./ld/testsuite/ld-powerpc/vxworks1.ld
--- ./ld/testsuite/ld-powerpc/vxworks1.ld	2006-03-02 08:46:33.000000000 +0000
+++ ./ld/testsuite/ld-powerpc/vxworks1.ld	2006-03-02 09:26:17.000000000 +0000
@@ -24,4 +24,7 @@ SECTIONS
 
   . = ALIGN (0x400);
   .bss : { *(.bss) }
+
+  . = ALIGN (0x400);
+  .data : { *(.data) }
 }
diff -udprN ../src.1/ld/testsuite/ld-powerpc/vxworks1-lib.rd ./ld/testsuite/ld-powerpc/vxworks1-lib.rd
--- ./ld/testsuite/ld-powerpc/vxworks1-lib.rd	2006-03-02 08:46:33.000000000 +0000
+++ ./ld/testsuite/ld-powerpc/vxworks1-lib.rd	2006-03-02 09:29:08.000000000 +0000
@@ -4,8 +4,9 @@ Relocation section '\.rela\.plt' at offs
 0008140c  .*15 R_PPC_JMP_SLOT    00000000   sexternal \+ 0
 00081410  .*15 R_PPC_JMP_SLOT    00080c48   sglobal \+ 0
 
-Relocation section '\.rela\.dyn' at offset .* contains 4 entries:
+Relocation section '\.rela\.dyn' at offset .* contains 5 entries:
  Offset     Info    Type            Sym\.Value  Sym\. Name \+ Addend
+00081c00  00000016 R_PPC_RELATIVE * 00080c44
 00080c0e  .*06 R_PPC_ADDR16_HA   00000000   __GOTT_BASE__ \+ 0
 00080c12  .*04 R_PPC_ADDR16_LO   00000000   __GOTT_BASE__ \+ 0
 00080c16  .*03 R_PPC_ADDR16      00000000   __GOTT_INDEX__ \+ 0
diff -udprN ../src.1/ld/testsuite/ld-powerpc/vxworks1-lib.s ./ld/testsuite/ld-powerpc/vxworks1-lib.s
--- ./ld/testsuite/ld-powerpc/vxworks1-lib.s	2006-03-02 08:46:33.000000000 +0000
+++ ./ld/testsuite/ld-powerpc/vxworks1-lib.s	2006-03-02 09:39:58.000000000 +0000
@@ -32,4 +32,7 @@ sglobal:
 	blr
 	.size	sglobal, .-sglobal
 
+	.data
+	.4byte	slocal
+
 	.comm	x,4,4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [committed] Make is_ppc_elf_target return true for VxWorks files
  2006-03-02  9:50 [committed] Make is_ppc_elf_target return true for VxWorks files Richard Sandiford
@ 2006-03-02 11:29 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2006-03-02 11:29 UTC (permalink / raw)
  To: binutils, richard

On Thu, Mar 02, 2006 at 09:50:25AM +0000, Richard Sandiford wrote:
> bfd/
> 	* elf32-ppc.c (is_ppc_elf_target): Return true if the target is
> 	bfd_elf32_powerpc_vxworks_vec.
> 
> ld/testsuite/
> 	* ld-i386/vxworks1.ld (.data): New section.
> 	* ld-i386/vxworks1-lib.s: Add a pointer to a local symbol.
> 	* ld-i386/vxworks1-lib.rd: Test for the associated reloc.
> 	* ld-powerpc/vxworks1.ld (.data): New section.
> 	* ld-powerpc/vxworks1-lib.s: Add a pointer to a local symbol.
> 	* ld-powerpc/vxworks1-lib.rd: Test for the associated reloc.

OK.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-02 11:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-02  9:50 [committed] Make is_ppc_elf_target return true for VxWorks files Richard Sandiford
2006-03-02 11:29 ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).