This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Fix -Ttext and friends for ELF systems
Mark Mitchell <mark@codesourcery.com> writes:
> >I do agree that the linker script has to cooperate. Suppose that,
> >rather than the simple mechanism of setting a symbol, you use the more
> >complex mechanism of adding a new expression to the linker script:
> >SEGMENT_START(NAME, DEFAULT). In your script, it might be used as
> > TEXT_START_ADDR='SEGMENT_START ("text", ${TEXT_START_ADDR})'
> >
> Here is a patch which implements your suggestion. In particular, for
> linker scripts which do not use SEGMENT_START, there will be no change
> in behavior.
>
> Is this OK to commit?
> --- 258,270 ----
> <EXPRESSION,BOTH>"ASSERT" { RTOKEN(ASSERT_K); }
> <BOTH,SCRIPT>"ENTRY" { RTOKEN(ENTRY);}
> <BOTH,SCRIPT,MRI>"EXTERN" { RTOKEN(EXTERN);}
> <EXPRESSION,BOTH,SCRIPT>"NEXT" { RTOKEN(NEXT);}
> <EXPRESSION,BOTH,SCRIPT>"sizeof_headers" { RTOKEN(SIZEOF_HEADERS);}
> ! <EXPRESSION,BOTH,SCRIPT>"SIZEOF_HEADERS" {
> ! RTOKEN(SIZEOF_HEADERS);}
> ! <EXPRESSION,BOTH,SCRIPT>"SEGMENT_START" { RTOKEN(SEGMENT_START);}
> <BOTH,SCRIPT>"MAP" { RTOKEN(MAP);}
> <EXPRESSION,BOTH,SCRIPT>"SIZEOF" { RTOKEN(SIZEOF);}
> <BOTH,SCRIPT>"TARGET" { RTOKEN(TARGET_K);}
> <BOTH,SCRIPT>"SEARCH_DIR" { RTOKEN(SEARCH_DIR);}
> <BOTH,SCRIPT>"OUTPUT" { RTOKEN(OUTPUT);}
Looks like an accidental line break in the SIZEOF_HEADERS line.
Please add an entry to ld/NEWS.
OK with those changes.
Could you look into fixing up scripttempl/elf.sc to use SEGMENT_START?
Ian