[PATCH/RFA] Fix C-referenceable sections with explicit LMAs
Nick Clifton
nickc@redhat.com
Fri Dec 6 09:25:00 GMT 2002
Hi Jason,
> Yes indeed. Here is the patch for current Binutils, as well as a
> test case. Test case fails without the patch, passes with, and no
> new regressions (tested on arm-netbsdelf).
>
> OK for mainline? OK for 2.13 branch?
>
> * ldexp.c (fold_name): Handle SIZEOF_UNADJ. When handling
> SIZEOF, apply any size adjustment that has been recorded
> for the section.
> * ldgram.y (SIZEOF_UNADJ): New token.
> * ldlang.c (lang_output_section_statement_lookup): Initialize
> size_adj and last_orphan members.
> * ldlang.h (lang_output_section_statement_type): Add size_adj
> and last_orphan members.
> * emultempl/elf32.em (place_orphan): If no .rodata output section
> is present, allow read-only data to be placed with .text. If
> the output section has an explicit LMA, compute an explicit LMA
> for the orphan based on the LMA of the output section or the
> previous orphan. Record a size adjustment of the output section
> for each orphan placed with it.
>
> * ld-scripts/refsec-lma.exp: New test.
> * ld-scripts/refsec-lma.s: New test.
> * ld-scripts/refsec-lma.t: New test.
Approved for the mainline. I am not sure about the branch though -
lets wait a few days to see if the patch creates any problems first.
Before applying the patch though, please could you fix the following
issues:
> Index: ldexp.c
> + case SIZEOF_UNADJ: /* not actually allowed in grammar */
Formatting of comment.
> Index: testsuite/ld-scripts/refsec-lma.exp
> + # This tests a feature found in the ELF back-end.
> + if { ![istarget *-*-sysv4*] \
> + && ![istarget *-*-unixware*] \
> + && ![istarget *-*-elf*] \
> + && ![istarget *-*-eabi*] \
> + && ![istarget hppa*64*-*-hpux*] \
> + && ![istarget *-*-linux*] \
> + && ![istarget *-*-netbsd*] \
> + && ![istarget *-*-irix5*] \
> + && ![istarget *-*-irix6*] \
> + && ![istarget *-*-solaris2*] } {
> + return
> + }
> +
> + if { [istarget *-*-linux*aout*] \
> + || [istarget *-*-linux*oldld*] } {
> + return
> + }
These tests can already be found in ld-lib.exp as proc is_elf_format.
> + if { ![istarget *-*-netbsdelf*] \
> + && [[istarget *-*-netbsd*aout*] \
> + || [istarget *-*-netbsdpe*] \
> + || [istarget arm*-*-netbsd*] \
> + || [istarget sparc-*-netbsd*] \
> + || [istarget i*86-*-netbsd*] \
> + || [istarget m68*-*-netbsd*] \
> + || [istarget vax*-*-netbsd*] \
> + || [istarget ns32k-*-netbsd*]] } {
> + return
> + }
This does not work. The double square brackets should be replace with
a round bracket and a square bracket, ie:
if { ![istarget *-*-netbsdelf*] \
&& ([istarget *-*-netbsd*aout*] \
|| [istarget *-*-netbsdpe*] \
|| [istarget arm*-*-netbsd*] \
|| [istarget sparc-*-netbsd*] \
|| [istarget i*86-*-netbsd*] \
|| [istarget m68*-*-netbsd*] \
|| [istarget vax*-*-netbsd*] \
|| [istarget ns32k-*-netbsd*]) } {
return
}
Cheers
Nick
More information about the Binutils
mailing list