From 3231d22e8fb33768ce829f368b33b8a0594a3e18 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 5 Sep 2000 04:07:46 +0000 Subject: Shared lib support for elf32-hppa --- ld/ChangeLog | 21 +++++++++ ld/emulparams/hppalinux.sh | 5 ++ ld/emultempl/hppaelf.em | 81 +++++++++++++++++++++++++++------ ld/testsuite/ChangeLog | 4 ++ ld/testsuite/ld-selective/selective.exp | 4 -- 5 files changed, 97 insertions(+), 18 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 84bdae4..bbaeb79 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,26 @@ 2000-09-05 Alan Modra + * 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'. diff --git a/ld/emulparams/hppalinux.sh b/ld/emulparams/hppalinux.sh index f270ba6..883f210 100644 --- a/ld/emulparams/hppalinux.sh +++ b/ld/emulparams/hppalinux.sh @@ -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 diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em index 3139785..fa32772 100644 --- a/ld/emultempl/hppaelf.em +++ b/ld/emultempl/hppaelf.em @@ -27,7 +27,6 @@ cat >>e${EMULATION_NAME}.c <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 diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 7a11b51..8b8f20d 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2000-09-05 Alan Modra + + * ld-selective/selective.exp: Remove the xfails for hppa. + 2000-08-30 Alexandre Oliva * ld-undefined/undefined.exp (hppa*64*-*-*, mn10300-*-elf, diff --git a/ld/testsuite/ld-selective/selective.exp b/ld/testsuite/ld-selective/selective.exp index 75b5586..20b3a12 100644 --- a/ld/testsuite/ld-selective/selective.exp +++ b/ld/testsuite/ld-selective/selective.exp @@ -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 -- cgit v1.1