Integrate / parameterize changes from Chuq Silvers / Nick Hudson to

simplify GP handling on HPPA for NetBSD, and get dynamically-linked
executables working.  Changes to be submitted to FSF:

bfd:
	* config.bfd (hppa*-*-netbsd*): Set targ_defvec to
	bfd_elf32_hppa_nbsd_vec.  Add bfd_elf32_hppa_linux_vec
	to targ_selvecs.
	* configure.in (bfd_elf32_hppa_nbsd_vec): Add case.
	* configure.in: Regenerate.
	* elf32-hppa.c (elf32_hppa_object_p): Add "elf32-hppa-netbsd"
	case that accepts OSABI=NetBSD and OSABI=SysV.
	(elf32_hppa_set_gp): For "elf32-hppa-netbsd", set the GP to
	the base of .got or .data (if .got does not exist).
	(elf32_hppa_post_process_headers): For elf32-hppa-netbsd,
	set OSABI=NetBSD.
	(TARGET_BIG_SYM): Add bfd_elf32_hppa_nbsd_vec case.
	(TARGET_BIG_NAME): Add "elf32-hppa-netbsd" case.
	* targets.c (bfd_elf32_hppa_nbsd_vec): Add extern declaration.
	(_bfd_target_vector): Add bfd_elf32_hppa_nbsd_vec.

gas:
	* config/tc-hppa.h (TARGET_FORMAT): Set to "elf32-hppa-netbsd"
	for TE_NetBSD.

ld:
	* emulparams/hppanbsd.sh (OUTPUT_FORMAT): Set to "elf32-hppa-netbsd".
This commit is contained in:
thorpej 2004-07-20 20:47:18 +00:00
parent a3f3869414
commit eb9f224468
7 changed files with 44 additions and 7 deletions

View File

@ -351,10 +351,14 @@ case "${targ}" in
;;
#endif
hppa*-*-linux-gnu* | hppa*-*-netbsd* )
hppa*-*-linux-gnu*)
targ_defvec=bfd_elf32_hppa_linux_vec
targ_selvecs=bfd_elf32_hppa_vec
;;
hppa*-*-netbsd*)
targ_defvec=bfd_elf32_hppa_nbsd_vec
targ_selvecs="bfd_elf32_hppa_vec bfd_elf32_hppa_linux_vec"
;;
hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems* | hppa*-*-openbsd*)
targ_defvec=bfd_elf32_hppa_vec
targ_selvecs=bfd_elf32_hppa_linux_vec

View File

@ -6119,6 +6119,7 @@ do
bfd_elf32_frv_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;;
bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;;
bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_nbsd_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;

View File

@ -581,6 +581,7 @@ do
bfd_elf32_frv_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;;
bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;;
bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_nbsd_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;

View File

@ -1064,6 +1064,14 @@ elf32_hppa_object_p (abfd)
if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_LINUX)
return FALSE;
}
else if (strcmp (bfd_get_target (abfd), "elf32-hppa-netbsd") == 0)
{
/* GCC on hppa-netbsd produces binaries with OSABI=NetBSD,
but the kernel produces corefiles with OSABI=SysV. */
if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_NETBSD &&
i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_NONE) /* aka SYSV */
return FALSE;
}
else
{
if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_HPUX)
@ -3183,7 +3191,8 @@ elf32_hppa_set_gp (abfd, info)
if either the .plt or .got is larger than 0x2000. If both
the .plt and .got are smaller than 0x2000, choose the end of
the .plt section. */
sec = splt;
sec = strcmp (bfd_get_target (abfd), "elf32-hppa-netbsd") == 0
? NULL : splt;
if (sec != NULL)
{
gp_val = sec->_raw_size;
@ -3197,10 +3206,13 @@ elf32_hppa_set_gp (abfd, info)
sec = sgot;
if (sec != NULL)
{
/* We know we don't have a .plt. If .got is large,
offset our LTP. */
if (sec->_raw_size > 0x2000)
gp_val = 0x2000;
if (strcmp (bfd_get_target (abfd), "elf32-hppa-netbsd") != 0)
{
/* We know we don't have a .plt. If .got is large,
offset our LTP. */
if (sec->_raw_size > 0x2000)
gp_val = 0x2000;
}
}
else
{
@ -4378,6 +4390,10 @@ elf32_hppa_post_process_headers (abfd, link_info)
{
i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_LINUX;
}
else if (strcmp (bfd_get_target (abfd), "elf32-hppa-netbsd") == 0)
{
i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_NETBSD;
}
else
{
i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX;
@ -4450,3 +4466,10 @@ elf32_hppa_elf_get_symbol_type (elf_sym, type)
#define INCLUDED_TARGET_FILE 1
#include "elf32-target.h"
#undef TARGET_BIG_SYM
#define TARGET_BIG_SYM bfd_elf32_hppa_nbsd_vec
#undef TARGET_BIG_NAME
#define TARGET_BIG_NAME "elf32-hppa-netbsd"
#include "elf32-target.h"

View File

@ -523,6 +523,7 @@ extern const bfd_target bfd_elf32_fr30_vec;
extern const bfd_target bfd_elf32_frv_vec;
extern const bfd_target bfd_elf32_h8300_vec;
extern const bfd_target bfd_elf32_hppa_linux_vec;
extern const bfd_target bfd_elf32_hppa_nbsd_vec;
extern const bfd_target bfd_elf32_hppa_vec;
extern const bfd_target bfd_elf32_i370_vec;
extern const bfd_target bfd_elf32_i386_freebsd_vec;
@ -811,6 +812,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_frv_vec,
&bfd_elf32_h8300_vec,
&bfd_elf32_hppa_linux_vec,
&bfd_elf32_hppa_nbsd_vec,
&bfd_elf32_hppa_vec,
&bfd_elf32_i370_vec,
&bfd_elf32_i386_freebsd_vec,

View File

@ -55,13 +55,17 @@
#endif
#else /* TARGET_ARCH_SIZE == 32 */
#include "bfd/elf32-hppa.h"
#if defined (TE_LINUX) || defined (TE_NetBSD)
#if defined (TE_LINUX)
#define TARGET_FORMAT "elf32-hppa-linux"
#else
#if defined (TE_NetBSD)
#define TARGET_FORMAT "elf32-hppa-netbsd"
#else
#define TARGET_FORMAT "elf32-hppa"
#endif
#endif
#endif
#endif
#ifdef OBJ_SOM
#include "bfd/som.h"

View File

@ -2,3 +2,5 @@
# hppaobsd.sh
. ${srcdir}/emulparams/hppalinux.sh
OUTPUT_FORMAT="elf32-hppa-netbsd"