Linux target variants for elfxx-hppa.

This commit is contained in:
Alan Modra 2001-01-14 11:12:53 +00:00
parent ffd6e9debc
commit d952f17a9d
9 changed files with 193 additions and 114 deletions

View File

@ -1,5 +1,19 @@
2001-01-14 Alan Modra <alan@linuxcare.com.au>
* 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.
* elf32-hppa.c (elf32_hppa_link_hash_table): Add text_segment_base,
and data_segment_base fields.
(elf32_hppa_link_hash_table_create ): Init them.

View File

@ -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)

30
bfd/configure vendored
View File

@ -5932,7 +5932,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 ;;
@ -5955,7 +5956,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"
@ -6177,17 +6179,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:6181: checking for $ac_hdr" >&5
echo "configure:6183: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6186 "configure"
#line 6188 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:6191: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:6193: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -6216,12 +6218,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6220: checking for $ac_func" >&5
echo "configure:6222: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6225 "configure"
#line 6227 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -6244,7 +6246,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:6248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -6269,7 +6271,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
echo "configure:6273: checking for working mmap" >&5
echo "configure:6275: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -6277,7 +6279,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
#line 6281 "configure"
#line 6283 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@ -6417,7 +6419,7 @@ main()
}
EOF
if { (eval echo configure:6421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:6423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@ -6442,12 +6444,12 @@ fi
for ac_func in madvise mprotect
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6446: checking for $ac_func" >&5
echo "configure:6448: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6451 "configure"
#line 6453 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -6470,7 +6472,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:6474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else

View File

@ -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"

View File

@ -399,6 +399,9 @@ static boolean elf32_hppa_finish_dynamic_symbol
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 (output_bfd, info)
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, type)
#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
@ -4285,3 +4310,11 @@ elf32_hppa_elf_get_symbol_type (elf_sym, type)
#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"

View File

@ -1166,8 +1166,15 @@ elf64_hppa_post_process_headers (abfd, link_info)
i_ehdrp = elf_elfheader (abfd);
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
@ -2657,3 +2664,11 @@ const struct elf_size_info hppa64_elf_size_info =
#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"

View File

@ -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_vec;
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_cris_vec;
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_vector[] = {
#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_vector[] = {
&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

View File

@ -1,5 +1,7 @@
2001-01-14 Alan Modra <alan@linuxcare.com.au>
* emulparams/hppalinux.sh (OUTPUT_FORMAT): Set to elf32-hppa-linux.
* emultempl/hppaelf.em (hppaelf_after_parse): New function,
enabling search for libmilli. On a relocatable link, make .text
sections unique.

View File

@ -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