This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [David Mosberger <davidm@hpl.hp.com>] problem with unwind info for .init/.fini sections
On Thu, Feb 28, 2002 at 05:43:07PM -0800, David Mosberger wrote:
> >>>>> On Thu, 28 Feb 2002 17:33:11 -0800, "H . J . Lu" <hjl@lucon.org> said:
>
> HJ> I believe glibc is ok. The problem is binutils. I didn't see any
> HJ> supports for DT_INIT_ARRAY, DT_FINI_ARRAY. DT_INIT_ARRAYSZ,
> HJ> DT_FINI_ARRAYSZ, DT_PREINIT_ARRAY nor DT_PREINIT_ARRAYSZ.
>
> Shouldn't this be easy straight-forward to add?
>
I haven't looked at them closely. Mu guess is it shouldn't be too hard.
You just need to handle .init_array/.fini_array/.preinit_arrary. Here
is something to begin with. You need to set those DT_XXX entries from
those .init_array, .fini_array and .preinit_array sections.
H.J.
--
--- bfd/elf.c.array Tue Feb 19 15:17:40 2002
+++ bfd/elf.c Thu Feb 28 18:01:34 2002
@@ -2178,6 +2178,18 @@ elf_fake_sections (abfd, asect, failedpt
this_hdr->sh_type = SHT_REL;
this_hdr->sh_entsize = bed->s->sizeof_rel;
}
+ else if (strcmp (name, ".init_array") == 0)
+ {
+ hdr->sh_type = SHT_INIT_ARRAY;
+ }
+ else if (strcmp (name, ".fini_array") == 0)
+ {
+ hdr->sh_type = SHT_FINI_ARRAY;
+ }
+ else if (strcmp (name, ".preinit_array") == 0)
+ {
+ hdr->sh_type = SHT_PREINIT_ARRAY;
+ }
else if (strncmp (asect->name, ".note", 5) == 0)
this_hdr->sh_type = SHT_NOTE;
else if (strncmp (asect->name, ".stab", 5) == 0