This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Linux target variants for elfxx-hppa


Hi,
  These patches add elf{32,64}-hppa-linux bfd targets since the existing
targets set OSABI to ELFOSABI_HPUX, which is wrong for Linux.

bfd/ChangeLog
	* config.bfd: Add linux target variant for elfxx-hppa.
	* configure.in: Recognize bfd_elf32_hppa_linux_vec and
	bfd_elf64_hppa_linux_vec.
	* configure: Regenerate.
	* elf64-hppa.c: Include elf64-target.h again to support linux
	target variant.
	(elf64_hppa_post_process_headers): Set ELFOSABI_LINUX for linux.
	* elf32-hppa.c: Include elf32-target.h again to support linux
	target variant.
	(elf32_hppa_post_process_headers): New function.
	(elf_backend_post_process_headers): Define.
	* targets.c (bfd_target_vector): Add bfd_elf64_hppa_linux_vec and
	bfd_elf32_hppa_linux_vec.

gas/ChangeLog
	* config/tc-hppa.h (TARGET_FORMAT): Add hppa-linux variants.

ld/ChangeLog
	* emulparams/hppalinux.sh (OUTPUT_FORMAT): Set to elf32-hppa-linux.

Alan Modra
-- 
Linuxcare.  Support for the Revolution.

Index: bfd/config.bfd
===================================================================
RCS file: /cvs/src/src/bfd/config.bfd,v
retrieving revision 1.47
diff -u -p -r1.47 config.bfd
--- config.bfd	2000/12/01 18:37:16	1.47
+++ config.bfd	2001/01/14 10:31:14
@@ -257,16 +257,23 @@ case "${targ}" in
 
 #ifdef BFD64
   hppa*64*-*-linux-gnu*)
-    targ_defvec=bfd_elf64_hppa_vec
+    targ_defvec=bfd_elf64_hppa_linux_vec
+    targ_selvecs=bfd_elf64_hppa_vec
     ;;
   hppa*64*-*-hpux11*)
     targ_defvec=bfd_elf64_hppa_vec
+    targ_selvecs=bfd_elf64_hppa_linux_vec
     targ_cflags=-DHPUX_LARGE_AR_IDS
     ;;
 #endif
 
-  hppa*-*-*elf* | hppa*-*-linux-gnu* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems*)
+  hppa*-*-linux-gnu*)
+    targ_defvec=bfd_elf32_hppa_linux_vec
+    targ_selvecs=bfd_elf32_hppa_vec
+    ;;
+  hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems*)
     targ_defvec=bfd_elf32_hppa_vec
+    targ_selvecs=bfd_elf32_hppa_linux_vec
     ;;
 
 #if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined (HOST_HPPAMPEIX)
Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.39
diff -u -p -r1.39 configure.in
--- configure.in	2001/01/12 03:34:47	1.39
+++ configure.in	2001/01/14 10:31:16
@@ -481,7 +481,8 @@ do
   				target64=true ;;
     bfd_elf64_alpha_vec)	tb="$tb elf64-alpha.lo elf64.lo $elf"
 				target64=true ;;
-    bfd_elf64_hppa_vec)		tb="$tb elf64-hppa.lo elf64.lo $elf"
+    bfd_elf64_hppa_vec | bfd_elf64_hppa_linux_vec)
+				tb="$tb elf64-hppa.lo elf64.lo $elf"
 				target64=true ;;
     bfd_elf64_ia64_little_vec)	tb="$tb elf64-ia64.lo elf64.lo $elf"
 				target64=true ;;
@@ -504,7 +505,8 @@ do
     bfd_elf32_d10v_vec)		tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
     bfd_elf32_d30v_vec)		tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
     bfd_elf32_fr30_vec)		tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
-    bfd_elf32_hppa_vec)		tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
+    bfd_elf32_hppa_vec | bfd_elf32_hppa_linux_vec)
+				tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
     bfd_elf32_i370_vec)		tb="$tb elf32-i370.lo elf32.lo $elf" ;;
     bfd_elf32_i386_vec)		tb="$tb elf32-i386.lo elf32.lo $elf" ;;
     bfd_elf64_x86_64_vec)	tb="$tb elf64-x86-64.lo elf64.lo $elf"
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.24
diff -u -p -r1.24 elf32-hppa.c
--- elf32-hppa.c	2001/01/14 07:03:48	1.24
+++ elf32-hppa.c	2001/01/14 10:31:28
@@ -399,6 +399,9 @@ static boolean elf32_hppa_finish_dynamic
 static boolean elf32_hppa_finish_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
 
+static void elf32_hppa_post_process_headers
+  PARAMS ((bfd *, struct bfd_link_info *));
+
 static int elf32_hppa_elf_get_symbol_type
   PARAMS ((Elf_Internal_Sym *, int));
 
@@ -4233,6 +4236,27 @@ elf32_hppa_finish_dynamic_sections (outp
   return true;
 }
 
+/* Tweak the OSABI field of the elf header.  */
+
+static void
+elf32_hppa_post_process_headers (abfd, link_info)
+     bfd *abfd;
+     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+{
+  Elf_Internal_Ehdr * i_ehdrp;
+
+  i_ehdrp = elf_elfheader (abfd);
+
+  if (strcmp (bfd_get_target (abfd), "elf32-hppa-linux") == 0)
+    {
+      i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_LINUX;
+    }
+  else
+    {
+      i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX;
+    }
+}
+
 /* Called when writing out an object file to decide the type of a
    symbol.  */
 static int
@@ -4269,6 +4293,7 @@ elf32_hppa_elf_get_symbol_type (elf_sym,
 #define elf_backend_gc_sweep_hook	     elf32_hppa_gc_sweep_hook
 #define elf_backend_object_p		     elf32_hppa_object_p
 #define elf_backend_final_write_processing   elf_hppa_final_write_processing
+#define elf_backend_post_process_headers     elf32_hppa_post_process_headers
 #define elf_backend_get_symbol_type	     elf32_hppa_elf_get_symbol_type
 
 #define elf_backend_can_gc_sections	     1
@@ -4284,4 +4309,12 @@ elf32_hppa_elf_get_symbol_type (elf_sym,
 #define ELF_MACHINE_CODE	EM_PARISC
 #define ELF_MAXPAGESIZE		0x1000
 
+#include "elf32-target.h"
+
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM			bfd_elf32_hppa_linux_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME			"elf32-hppa-linux"
+
+#define INCLUDED_TARGET_FILE 1
 #include "elf32-target.h"
Index: bfd/elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.9
diff -u -p -r1.9 elf64-hppa.c
--- elf64-hppa.c	2001/01/14 05:22:51	1.9
+++ elf64-hppa.c	2001/01/14 10:31:34
@@ -1166,8 +1166,15 @@ elf64_hppa_post_process_headers (abfd, l
 
   i_ehdrp = elf_elfheader (abfd);
 
-  i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX;
-  i_ehdrp->e_ident[EI_ABIVERSION] = 1;
+  if (strcmp (bfd_get_target (abfd), "elf64-hppa-linux") == 0)
+    {
+      i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_LINUX;
+    }
+  else
+    {
+      i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX;
+      i_ehdrp->e_ident[EI_ABIVERSION] = 1;
+    }
 }
 
 /* Create function descriptor section (.opd).  This section is called .opd
@@ -2656,4 +2663,12 @@ const struct elf_size_info hppa64_elf_si
 #define elf_backend_plt_header_size     0
 #define elf_backend_type_change_ok true
 
+#include "elf64-target.h"
+
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM			bfd_elf64_hppa_linux_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME			"elf64-hppa-linux"
+
+#define INCLUDED_TARGET_FILE 1
 #include "elf64-target.h"
Index: bfd/targets.c
===================================================================
RCS file: /cvs/src/src/bfd/targets.c,v
retrieving revision 1.31
diff -u -p -r1.31 targets.c
--- targets.c	2000/12/20 19:53:10	1.31
+++ targets.c	2001/01/14 10:31:38
@@ -1,5 +1,5 @@
 /* Generic target-file-type support for the BFD library.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -508,6 +508,7 @@ extern const bfd_target bfd_efi_app_ia32
 extern const bfd_target bfd_efi_app_ia64_vec;
 extern const bfd_target bfd_elf64_alpha_vec;
 extern const bfd_target bfd_elf64_hppa_vec;
+extern const bfd_target bfd_elf64_hppa_linux_vec;
 extern const bfd_target bfd_elf64_ia64_little_vec;
 extern const bfd_target bfd_elf64_ia64_big_vec;
 extern const bfd_target bfd_elf32_ia64_big_vec;
@@ -526,6 +527,7 @@ extern const bfd_target bfd_elf32_us_cri
 extern const bfd_target bfd_elf32_d10v_vec;
 extern const bfd_target bfd_elf32_d30v_vec;
 extern const bfd_target bfd_elf32_hppa_vec;
+extern const bfd_target bfd_elf32_hppa_linux_vec;
 extern const bfd_target bfd_elf32_i370_vec;
 extern const bfd_target bfd_elf32_i386_vec;
 extern const bfd_target bfd_elf32_i860_vec;
@@ -719,6 +721,7 @@ const bfd_target * const bfd_target_vect
 #ifdef BFD64
 	&bfd_elf64_alpha_vec,
 	&bfd_elf64_hppa_vec,
+	&bfd_elf64_hppa_linux_vec,
 	&bfd_elf64_ia64_little_vec,
 	&bfd_elf64_ia64_big_vec,
 #endif
@@ -735,6 +738,7 @@ const bfd_target * const bfd_target_vect
 	&bfd_elf32_d10v_vec,
 	&bfd_elf32_d30v_vec,
 	&bfd_elf32_hppa_vec,
+	&bfd_elf32_hppa_linux_vec,
 	&bfd_elf32_i370_vec,
 	&bfd_elf32_i386_vec,
 #ifdef BFD64
Index: gas/config/tc-hppa.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.h,v
retrieving revision 1.14
diff -u -p -r1.14 tc-hppa.h
--- tc-hppa.h	2000/11/17 08:47:51	1.14
+++ tc-hppa.h	2001/01/14 10:31:58
@@ -1,5 +1,5 @@
 /* tc-hppa.h -- Header file for the PA
-   Copyright (C) 1989, 93, 94, 95, 96, 97, 98, 99, 2000
+   Copyright 1989, 93, 94, 95, 96, 97, 98, 99, 2000, 2001
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -48,10 +48,18 @@
 #ifdef OBJ_ELF
 #if TARGET_ARCH_SIZE == 64
 #include "bfd/elf64-hppa.h"
-#define TARGET_FORMAT "elf64-hppa"
+#ifdef TE_LINUX
+#define TARGET_FORMAT "elf64-hppa-linux"
 #else
+#define TARGET_FORMAT "elf64-hppa"
+#endif
+#else /* TARGET_ARCH_SIZE == 32 */
 #include "bfd/elf32-hppa.h"
+#ifdef TE_LINUX
+#define TARGET_FORMAT "elf32-hppa-linux"
+#else
 #define TARGET_FORMAT "elf32-hppa"
+#endif
 #endif
 #endif
 
Index: ld/emulparams/hppalinux.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/hppalinux.sh,v
retrieving revision 1.4
diff -u -p -r1.4 hppalinux.sh
--- hppalinux.sh	2000/09/15 10:42:27	1.4
+++ hppalinux.sh	2001/01/14 10:32:16
@@ -1,6 +1,6 @@
 SCRIPT_NAME=elf
 ELFSIZE=32
-OUTPUT_FORMAT="elf32-hppa"
+OUTPUT_FORMAT="elf32-hppa-linux"
 TEXT_START_ADDR=0x1000
 TARGET_PAGE_SIZE=0x1000
 MAXPAGESIZE=0x1000


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]