[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Regressions when building glibc for HPPA.

On Sun, May 23, 2010 at 9:17 AM, Carlos O'Donell
<carlos@systemhalted.org> wrote:
> I am still analyzing (3), (4) and (5) which appears to be related.

A bit of background...

In glibc/elf/dl-fptr.c the global variable "local" references itself
by taking the address of &local.boot_table. Computing the address of a
global variable requires a relocation because the address of the
program data is not known at link time (it will be relocated somewhere
by the dynamic linker).

However, there is a chicken-and-egg problem here. The problem leads to
segfaults under certain conditions when relocations are ordered in a
certain way (you will see later why).

The hppa and ia64 ports use this code to create official procedure
descriptors (OPDs) when processing OPD relocations e.g.
R_PARISC_PLABLE32. By requiring a relocation to setup the global
variable "local", it effectively requires that this particular
relocation (the one to compute the address of &local.boot_table) be
processed *before* any R_PARISC_PLABEL32 relocations. If you don't
process the relocation for &local.boot_table first you haven't
initialized all of local, and making a OPD may segfault.

It is possible that this could be fixed by sorting the relocations in
the linker (sort all non-OPD relocs before OPC relocs), but requiring
sorted relocations is a fragile solution. The best solution is to
remove the static initialization of that structure member when
compiling SHARED. This is what the current
debian/patches/hppa/local-_dl_fptr_init.diff does in eglibc-2.11.

However, the patch overlooked the non-SHARED case, and this caused the
regressions in tststatic, tststatic2, and tst-tls9-static.


The following patch is a lightly-tested (I built each test by hand and
verified they worked) update which implements the non-SHARED (static
linking) case.

Could you give the attached patch a try and tell me how the test results look?

Please replace local-_dl_fptr_init.diff and
local-ELF_MACHINE_BEFORE_RTLD_RELOC.diff with the attached patch and

I'm running my own test run, but I would like to be able to compare results.

That completes the 5 regressions that hppa currently has:

(1) tstdiomisc - Mark as expected fail until the compiler is fixed.

(2) tst-vfork1 - Kernel issue, mark this and tst-vfork2 as expected
fail until the kernel is fixed

(3) tststatic - Fixed by attached patch.

(4) tststatic2 - Likewise.

(5) tst-tls9-static - Likewise.


Attachment: dlfptr-all.diff
Description: Binary data

Reply to: