This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: fix invalid load module complaint from dld.sl under hppa64-hp-hpux11
- From: law at redhat dot com
- To: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Cc: ross dot alexander at uk dot neceur dot com, amodra at bigpond dot net dot au, binutils at sources dot redhat dot com
- Date: Sun, 16 Jun 2002 09:35:09 -0600
- Subject: Re: PATCH: fix invalid load module complaint from dld.sl under hppa64-hp-hpux11
- Reply-to: law at redhat dot com
In message <200206151911.g5FJBjkw009402@hiauly1.hia.nrc.ca>, "John David Anglin
" writes:
> > This fixed the segfault problem but dld.sl is complaining the shared
> > libraries are not valid load modules. The test program works
> > okay though. ldd also complains, so maybe I'll try to hunt the problem
> > down that way or using dlopen.
>
> This patch fixes the invalid load module complaint from dld.sl. The
> problem was __gp was being computed incorrectly when a section was
> stripped from the output.
>
> The first approach that I tried to fix the problem was to set
> hppa_info->plt_sec and the other section pointers maintained in
> hppa_info to NULL when the corresponding section was stripped
> from the output so that the checks in elf_hppa_final_link would
> work. This exposed a problem in elf_hppa_final_link_relocate.
> We were incorrectly using the .opd section to compute the relocation
> value for symbols where we didn't want an opd entry. In testing,
> I found other uses of hppa_info->opd_sec without a check to
> see if the pointer is NULL. I think these are harmless but
> possibly I should have persevered and added the checks.
>
> In the patch presented here, I just added checks in elf_hppa_final_link
> to see if a section has been excluded before using to compute __gp.
> I also fixed the opd entry use problem in elf_hppa_final_link_relocate.
>
> The changes to elf64-hppa.c are mainly cosmetic. I simplified a
> couple of code snippets. I moved a number of comments regarding the
> stripping of sections in elf64_hppa_size_dynamic_sections because
> _bfd_strip_section_from_output unconditionally removes a section
> from the output. It also conditionally removes the output section
> for the section if it becomes empty. I broke up the assert in
> elf64_hppa_size_dynamic_sections because it caused problems when
> I tried resetting the hppa_info pointers.
>
> I have tested the patch with builds and regression checks under
> hppa64-hp-hpux11* and hppa2.0w-hp-hpux11.00. I also have bootstrapped
> gcc 3.1.1 with and without "--enable-shared" on hppa64-hp-hpux11.11.
> There is no difference in test results except for the objc results
> where all execution tests fail with "--enable-shared". For example,
>
> Executing on host: /xxx/gnu/gcc-3.2/objdir/gcc/xgcc -B/xxx/gnu/gcc-3.2/objdi
> r/gc
> c/ /xxx/gnu/gcc-3.2/gcc/gcc/testsuite/objc/execute/_cmd.m -w -O0 -I/xxx/g
> nu/g
> cc-3.2/gcc/gcc/testsuite/../../libobjc -L/xxx/gnu/gcc-3.2/objdir/hppa64-hp-h
> pux1
> 1.00/libobjc/.libs -lobjc -lm -o /xxx/gnu/gcc-3.2/objdir/gcc/testsuite/_c
> md.x
> 0 (timeout = 300)
> PASS: objc/execute/_cmd.m compilation, -O0
> objc runtime: cannot find class Object
> FAIL: objc/execute/_cmd.m execution, -O0
>
> The objc fails are not new.
>
> Please install if OK.
>
> Dave
> --
> J. David Anglin dave.anglin@nrc.ca
> National Research Council of Canada (613) 990-0752 (FAX: 952-66
> 05)
>
> 2002-06-15 John David Anglin <dave@hiauly1.hia.nrc.ca>
>
> * elf-hppa.h (elf_hppa_final_link): Fix formatting in comment.
> Skip excluded sections in determing __gp value.
> (elf_hppa_final_link_relocate): Use the symbol's address in
> R_PARISC_FPTR64 relocations that don't need an opd entry.
> * elf64-hppa.c (allocate_dynrel_entries): Simplify code.
> (elf64_hppa_finalize_dynreloc): Likewise.
> (elf64_hppa_size_dynamic_sections): Move comments and fix typo.
> (elf64_hppa_finish_dynamic_symbol): Break up assert.
Thanks. Installed.
jeff