This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: (Fwd) wrong expected section attributes for .interp
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Ned Ludd <solar at gentoo dot org>, binutils at sources dot redhat dot com
- Cc: "pageexec at freemail dot hu" <pageexec at freemail dot hu>, pappy at gentoo dot org,azarah at gentoo dot org
- Date: Tue, 21 Oct 2003 23:37:29 -0700
- Subject: Re: (Fwd) wrong expected section attributes for .interp
- References: <3F913207.24903.7F1A445@localhost> <20031020161255.GB5702@lucon.org> <1066689421.2107.407.camel@simple>
On Mon, Oct 20, 2003 at 06:37:02PM -0400, Ned Ludd wrote:
> H. J. Lu
>
> The problem goes deeper than the .interp section alone. I think on the
> ppc arch these problems seem to present themselves the most.
>
> cat <<__EOF__> interp.c
> const char __invoke_dynamic_linker__[] __attribute__ ((section
> (".interp"))) = "/lib/ld-linux.so.2";
> __EOF__
> gcc -c interp.c
> # At this point you will see the problem with 2.14.90.0.6 20030820
>
> Over here at Gentoo we have had this fixed for some time.
>
> For binutils-2.14.90.0.6 we also apply a number of fixes and
> workarounds. I wont include a patch/diff for these as they can be found
> in our CVS tree. But here is the list.
>
> binutils-2.13.90.0.10-glibc21.patch
> binutils-2.14.90.0.4-sparc-nonpic.patch
> binutils-2.14.90.0.6-sparc-cfi.patch
> binutils-2.14.90.0.6-eh-frame-ro-2.patch
> binutils-2.14.90.0.4-ltconfig-multilib.patch
> binutils-2.14.90.0.5-s390-pie.patch
> binutils-2.14.90.0.5-ppc64-pie.patch
> binutils-2.13.90.0.10-x86_64-testsuite.patch
> binutils-2.13.90.0.10-x86_64-gotpcrel.patch
> binutils-2.13.90.0.18-testsuite-Wall-fixes.patch
> binutils-2.14.90.0.6-dont-crash-on-null-owner.patch
> binutils-2.14.90.0.6-merge-speedup.patch
> binutils-2.14.90.0.6-ia64-howto.patch
> binutils-2.14.90.0.6-ia64-sdata.patch
> binutils-2.14.90.0.6-ia64-speedup.patch
> binutils-2.14.90.0.6-ppc-bfd.patch
> binutils-2.14.90.0.6-bfd-elf-interp-3.patch
> binutils-2.13.90.0.20-array-sects-compat.patch
>
> So back to the one in question here.
> The tested fix for the interp problem is the
> binutils-2.14.90.0.6-bfd-elf-interp-3.patch
> but if you don't fix the other sections then you wont want to merge as
> is.
>
> vanilla patch to fix the problem
> http://dev.gentoo.org/~solar/patches/binutils-2.14.90.0.6-bfd-elf-interp.diff
>
> mega patch that fixes other outstanding problems.
> http://dev.gentoo.org/~solar/patches/binutils-2.14.90.0.6-gentoo-20031020.diff
>
> peace.
>
.interp, .strtab and .symtab can have SHF_ALLOC. This patch allows it
and always uses specificed section attributes.
H.J.
----
2003-10-21 H.J. Lu <hongjiu.lu@intel.com>
* config/obj-elf.c (obj_elf_change_section): Allow SHF_ALLOC
for .interp, .strtab and .symtab. Use specified section
attributes.
--- gas/config/obj-elf.c.attr 2003-09-23 08:16:44.000000000 -0700
+++ gas/config/obj-elf.c 2003-10-21 23:26:06.000000000 -0700
@@ -615,6 +615,7 @@ obj_elf_change_section (name, type, attr
segT sec;
flagword flags;
const struct bfd_elf_special_section *ssect;
+ bfd_boolean override = FALSE;
#ifdef md_flush_pending_output
md_flush_pending_output ();
@@ -684,11 +685,20 @@ obj_elf_change_section (name, type, attr
&& name[ssect->prefix_length] == '.'
&& (attr &~ ssect->attr &~ SHF_MERGE &~ SHF_STRINGS) == 0)
;
+ /* .interp, .strtab and .symtab can have SHF_ALLOC. */
+ else if (attr == SHF_ALLOC
+ && (strcmp (name, ".interp") == 0
+ || strcmp (name, ".strtab") == 0
+ || strcmp (name, ".symtab") == 0))
+ override = TRUE;
else
- as_warn (_("setting incorrect section attributes for %s"),
- name);
+ {
+ as_warn (_("setting incorrect section attributes for %s"),
+ name);
+ override = TRUE;
+ }
}
- if (old_sec == NULL)
+ if (!override && old_sec == NULL)
attr |= ssect->attr;
}