This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[patch] elf.sc: Only do INIT_START, INIT_END, FINI_START and FINI_END if relocating
- To: binutils at sources dot redhat dot com
- Subject: [patch] elf.sc: Only do INIT_START, INIT_END, FINI_START and FINI_END if relocating
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- Date: Tue, 11 Jul 2000 23:41:51 +0200
I guess this is an oversight rather than intentional. If not, please tell
why to do INIT_START, INIT_END, FINI_START or FINI_END at other times than
when relocating, so we can add a comment there. The only current user,
elf64hppa.sh, defines it unusable for a relative link.
While we're in elf.sc, imagine ld invoked with -Tbss 0x400000.
Now, unless data ends at exactly 0x400000, __bss_start and whatever use of
"." in OTHER_BSS_SYMBOLS will get surprising values. My workaround for
CRIS is to "smuggle" this into OTHER_BSS_END_SYMBOLS:
PROVIDE (__Sbss = SIZEOF(.sbss) != 0 ? ADDR(.sbss) : ADDR(.bss));
A bit hackish, but it gets the work done.
Does anyone care enough to propose something for the general
problem of getting the next "used" address, counting from dot?
We can do as above for __bss_start in elf.sc, but perhaps having
a new ld intrinsic, named for example NEXT_ADDRESS_WITH_CONTENT
or NEXT_USED_ADDRESS makes sense.
Ok to commit?
2000-07-11 Hans-Peter Nilsson <hp@axis.com>
* scripttempl/elf.sc (.init): Only do ${INIT_START} and
${INIT_END} if relocating.
(.fini): Likewise ${FINI_START} and ${FINI_END}.
Index: elf.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf.sc,v
retrieving revision 1.12
diff -p -c -r1.12 elf.sc
*** elf.sc 2000/06/19 02:05:53 1.12
--- elf.sc 2000/07/11 20:40:24
*************** SECTIONS
*** 198,206 ****
.init ${RELOCATING-0} :
{
! ${INIT_START}
KEEP (*(.init))
! ${INIT_END}
} =${NOP-0}
${DATA_PLT-${BSS_PLT-${PLT}}}
--- 198,206 ----
.init ${RELOCATING-0} :
{
! ${RELOCATING+${INIT_START}}
KEEP (*(.init))
! ${RELOCATING+${INIT_END}}
} =${NOP-0}
${DATA_PLT-${BSS_PLT-${PLT}}}
*************** SECTIONS
*** 217,225 ****
} =${NOP-0}
.fini ${RELOCATING-0} :
{
! ${FINI_START}
KEEP (*(.fini))
! ${FINI_END}
} =${NOP-0}
${RELOCATING+PROVIDE (__etext = .);}
${RELOCATING+PROVIDE (_etext = .);}
--- 217,225 ----
} =${NOP-0}
.fini ${RELOCATING-0} :
{
! ${RELOCATING+${FINI_START}}
KEEP (*(.fini))
! ${RELOCATING+${FINI_END}}
} =${NOP-0}
${RELOCATING+PROVIDE (__etext = .);}
${RELOCATING+PROVIDE (_etext = .);}
brgds, H-P