patch to make init_array work (2nd version; resend)
David Mosberger
davidm@napali.hpl.hp.com
Thu Nov 7 13:51:00 GMT 2002
>>>>> On Thu, 7 Nov 2002 13:31:39 -0800, Roland McGrath <roland@redhat.com> said:
Roland> Your dl-fini.c fix is obviously correct and I put that in.
Great! Thanks a lot!
Roland> None of the messages I have seen from you or HJ have
Roland> mentioned what the problem being fixed by HJ's changes was,
Roland> so I had to look at the whole thing for a while to figure
Roland> out what the point was. (The arrays are already processed
Roland> properly in loaded objects, but not in the executable
Roland> itself.) Now that I see the problem, I can at least put in
Roland> those test cases.
Sorry, I think neither HJ nor I were trying to be cryptic. Yes, the
main problem is indeed that .init_array/.fini_array don't get called
for the main program (though HJ's patch obviously address other things
as well, such as correcting the order of .fini_array calls and adding
test case).
Roland> I don't like HJ's implementation, which introduces three new
Roland> relocs in libc.so with weak references to symbols defined in
Roland> crt1.o. That's just nasty. The simple thing would be to
Roland> pass more arguments to __libc_start_main, which would
Roland> require versioning.
Roland> But I think that, in keeping with the convention that its
Roland> own .init/.fini are the executable's problem, it would be
Roland> cleanest for the arrays just to be handled by the existing
Roland> init/fini functions in the executable. That is, have the
Roland> single function pair it passes (now _init/_fini) do all the
Roland> work. My first thought was to just put the code into
Roland> crti.o/crtn.o, but this code should not go into shared
Roland> libraries.
OK, I _think_ I understand your concern. Perhaps we could just change
the platform-specific start.S to pass a different _init/_fini function
which takes care of calling init_array/fini_array? If you think that
would work, I can take a stab at doing that for
sysdeps/ia64/elf/start.S.
Thanks,
--david
More information about the Libc-hacker
mailing list