Shared lib support for elf32-hppa

This commit is contained in:
Alan Modra 2000-09-05 04:07:46 +00:00
parent 927781e250
commit 3231d22e8f
5 changed files with 97 additions and 18 deletions

View File

@ -1,5 +1,26 @@
2000-09-05 Alan Modra <alan@linuxcare.com.au>
* emultempl/hppaelf.em (hppaelf_add_stub_section): Add SEC_RELOC
to stub section flags.
(hppa_for_each_input_file_wrapper): New.
(hppa_lang_for_each_input_file): New.
(lang_for_each_input_file): Define to call above.
(multi_subspace): New.
(hppaelf_finish): Pass multi_subspace to elf32_hppa_size_stubs.
(PARSE_AND_LIST_PROLOGUE): Define.
(PARSE_AND_LIST_LONGOPTS): Define.
(PARSE_AND_LIST_OPTIONS): Define.
(PARSE_AND_LIST_ARGS_CASES): Define.
(hppaelf_finish): Call elf32_hppa_set_gp.
(hppaelf_set_output_arch): Remove.
(LDEMUL_SET_OUTPUT_ARCH): Remove.
* emulparams/hppalinux.sh (ELFSIZE): Define.
(MACHINE): Define.
(OTHER_READONLY_SECTIONS): Define.
(DATA_PLT): Define.
(GENERATE_SHLIB_SCRIPT): Define.
* ldlang.c: Add missing prototypes, and tidy others. Change CONST
to const throughout. Change `void *' to `PTR' throughout.
(lang_memory_default): Function is local to file, add `static'.

View File

@ -1,11 +1,16 @@
SCRIPT_NAME=elf
ELFSIZE=32
OUTPUT_FORMAT="elf32-hppa"
TEXT_START_ADDR=0x1000
TARGET_PAGE_SIZE=0x1000
MAXPAGESIZE=0x1000
ARCH=hppa
MACHINE=hppa1.1 # We use 1.1 specific features.
NOP=0x08000240
START="_start"
OTHER_READONLY_SECTIONS='.PARISC.unwind : { *(.PARISC.unwind) } '
DATA_START_SYMBOLS='$global$ = .;'
DATA_PLT=
GENERATE_SHLIB_SCRIPT=yes
TEMPLATE_NAME=elf32
EXTRA_EM_FILE=hppaelf

View File

@ -27,7 +27,6 @@ cat >>e${EMULATION_NAME}.c <<EOF
#include "ldctor.h"
#include "elf32-hppa.h"
static void hppaelf_set_output_arch PARAMS ((void));
static void hppaelf_create_output_section_statements PARAMS ((void));
static void hppaelf_delete_padding_statements
PARAMS ((lang_statement_list_type *));
@ -40,16 +39,11 @@ static void hppaelf_finish PARAMS ((void));
/* Fake input file for stubs. */
static lang_input_statement_type *stub_file;
/* Type of import/export stubs to build. For a single sub-space model,
we can build smaller import stubs and there is no need for export
stubs. */
static int multi_subspace = 0;
/* Set the output architecture and machine. */
static void
hppaelf_set_output_arch ()
{
unsigned long machine = 0;
bfd_set_arch_mach (output_bfd, ldfile_output_architecture, machine);
}
/* This is called before the input files are opened. We create a new
fake input file to hold the stub sections. */
@ -233,7 +227,7 @@ hppaelf_add_stub_section (stub_name, input_section)
goto err_ret;
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
| SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_KEEP);
| SEC_HAS_CONTENTS | SEC_RELOC | SEC_IN_MEMORY | SEC_KEEP);
if (!bfd_set_section_flags (stub_file->the_bfd, stub_sec, flags))
goto err_ret;
@ -295,6 +289,7 @@ hppaelf_finish ()
/* Call into the BFD backend to do the real work. */
if (! elf32_hppa_size_stubs (stub_file->the_bfd,
multi_subspace,
&link_info,
&hppaelf_add_stub_section,
&hppaelf_layaout_sections_again))
@ -303,18 +298,76 @@ hppaelf_finish ()
return;
}
/* Set the global data pointer. */
if (! elf32_hppa_set_gp (output_bfd, &link_info))
{
einfo ("%X%P: can not set gp\n");
return;
}
/* Now build the linker stubs. */
if (stub_file->the_bfd->sections != NULL)
{
if (! elf32_hppa_build_stubs (stub_file->the_bfd, &link_info))
if (! elf32_hppa_build_stubs (&link_info))
einfo ("%X%P: can not build stubs: %E\n");
}
}
/* Avoid processing the fake stub_file in vercheck, stat_needed and
check_needed routines. */
static void hppa_for_each_input_file_wrapper
PARAMS ((lang_input_statement_type *));
static void hppa_lang_for_each_input_file
PARAMS ((void (*) (lang_input_statement_type *)));
static void (*real_func) PARAMS ((lang_input_statement_type *));
static void hppa_for_each_input_file_wrapper (l)
lang_input_statement_type *l;
{
if (l != stub_file)
(*real_func) (l);
}
static void
hppa_lang_for_each_input_file (func)
void (*func) PARAMS ((lang_input_statement_type *));
{
real_func = func;
lang_for_each_input_file (&hppa_for_each_input_file_wrapper);
}
#define lang_for_each_input_file hppa_lang_for_each_input_file
EOF
# Put these routines in ld_${EMULATION_NAME}_emulation
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
PARSE_AND_LIST_PROLOGUE='
#define OPTION_MULTI_SUBSPACE 301
'
PARSE_AND_LIST_LONGOPTS='
{ "multi-subspace", no_argument, NULL, OPTION_MULTI_SUBSPACE},
'
PARSE_AND_LIST_OPTIONS='
fprintf (file, _("\
--multi-subspace Generate import and export stubs to support\n\
multiple sub-space shared libraries\n"
));
'
PARSE_AND_LIST_ARGS_CASES='
case OPTION_MULTI_SUBSPACE:
multi_subspace = 1;
break;
'
# Put these extra hppaelf routines in ld_${EMULATION_NAME}_emulation
#
LDEMUL_SET_OUTPUT_ARCH=hppaelf_set_output_arch
LDEMUL_FINISH=hppaelf_finish
LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=hppaelf_create_output_section_statements

View File

@ -1,3 +1,7 @@
2000-09-05 Alan Modra <alan@linuxcare.com.au>
* ld-selective/selective.exp: Remove the xfails for hppa.
2000-08-30 Alexandre Oliva <aoliva@redhat.com>
* ld-undefined/undefined.exp (hppa*64*-*-*, mn10300-*-elf,

View File

@ -46,8 +46,6 @@ if { [which $CXX] == 0 } {
return
}
setup_xfail "hppa*-*-*"
if { ![ld_compile "$CC $cflags" $srcdir/$subdir/1.c tmpdir/1.o]} {
unresolved $test1
return
@ -75,8 +73,6 @@ if ![ld_simple_link $ld tmpdir/1.x "$ldflags tmpdir/1.o"] {
}
}
setup_xfail "hppa*-*-*"
if { ![ld_compile "$CC $cflags" $srcdir/$subdir/2.c tmpdir/2.o]} {
unresolved $test2
return