Fix GHC ticket 2615 (linker scripts in .so files)
Howard B. Golden
hgolden at socal.rr.com
Wed Dec 2 16:08:38 EST 2009
Hi Simon M.,
On Wednesday December 2, 2009, Simon Marlow wrote:
> On 01/12/2009 06:49, Howard B. Golden wrote:
> > Mon Nov 30 22:12:34 PST 2009 howard_b_golden at yahoo.com
> > * Fix GHC ticket 2615 (linker scripts in .so files)
> > This patch only applies to systems that use ELF format files.
> > The patch modifies the addDLL function so that it recognizes
> > "invalid ELF header" errors. If these occur, the file that was
> > opened is scanned for a linker script GROUP ( ... ) directive. If
> > found, the first file inside the GROUP ( ... ) will be sent to
> > dlopen. Any errors reported by dlopen then will be reported to the
> > caller.
> Thanks Howard. I think the patch could do with a round of tweaks
> before being pushed, comments below.
I will make the changes you suggest. Then I'll follow the full
validation process. I have done much of this already. I noticed that
there is only 1 failure: T1969. I don't think I can do anything about
that, so I plan to disregard it. Please confirm.
> Can we rely on the availability of regex.h and POSIX regexes? Does
> this need a configure test?
I don't know the answer to this. Isn't POSIX part of the baseline
assumption? If not, I would need some help with the autoconf changes,
since I haven't done any before.
> We don't generally use atexit() in the RTS, all the cleanup has to be
> done by hs_exit(). Typically each subsystem has an exitFoo() or
> freeFoo() function called by hs_exit().
I'm uncertain about what I should do here. Should I simply remove the
atexit() and the callback code. Or should I somehow link it up to
> I think you left some debug output in here. Suggest protecting it
> with IF_DEBUG(linker, ...).
I already discovered this when I ran the validation script.
I'm not sure how to write a test case that can be added to the
validation tests. By _hand_ I have been testing by running:
$ ghc-stage2 --interactive -lpcre
On my system (Gentoo), /usr/lib64/libpcre.so is a linker script.
However, I don't think this will always be true on other systems. I'd
appreciate some suggestions about how to write the test.
> Also I suggest adding a comment referring to the ticket number, and
> an brief description of the problem and solution.
I will add this.
Thanks for your thorough review! Now that I understand the QC process
(validation scripts) I will try to use it as intended.
More information about the Cvs-ghc