Skip to contentSkip to conversation

File name substitution in linker scripts

U-Boot Stefan Roese 2 participants 2 messages Oct 26, 2009

lore
Share & tools
lore
#0 lore raw

I'm wondering if and how it's possible to use a "variable" file name for inclusion in a linker script. Reason for this is the consolidation of the ppc4xx linker scripts, where some boards (PPC440) include a board specific file (e.g. board/amcc/canyonlands/init.o) into the section "bootpg":

  .bootpg RESET_VECTOR_ADDRESS - 0xffc :
  {
    cpu/ppc4xx/start.o	(.bootpg)
    board/amcc/canyonlands/init.o	(.bootpg)
  }

Is there a way to write something like this:

  .bootpg RESET_VECTOR_ADDRESS - 0xffc :
  {
    cpu/ppc4xx/start.o	(.bootpg)
    board/$(BOARDDIR)/init.o	(.bootpg)
  }

in a linker script?

Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

#1 lore raw

Dear Stefan Roese,

Quoted 4 lines · In message <[email protected]> you wrote:

I'm wondering if and how it's possible to use a "variable" file name for inclusion in a linker script. Reason for this is the consolidation of the ppc4xx linker scripts, where some boards (PPC440) include a board specific file (e.g. board/amcc/canyonlands/init.o) into the section "bootpg":

All linker scripts are run through the C preprocessor...

Quoted 6 lines
  .bootpg RESET_VECTOR_ADDRESS - 0xffc :
  {
    cpu/ppc4xx/start.o	(.bootpg)
    board/amcc/canyonlands/init.o	(.bootpg)
  }
Quoted 7 lines

Is there a way to write something like this:

  .bootpg RESET_VECTOR_ADDRESS - 0xffc :
  {
    cpu/ppc4xx/start.o	(.bootpg)
    board/$(BOARDDIR)/init.o	(.bootpg)
  }

Eventually

board/CONFIG_HOSTNAME/init.o (.bootpg)

might work (untested).

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"...this does not mean that some of us should not want, in  a  rather
dispassionate sort of way, to put a bullet through csh's head."
                   - Larry Wall in <[email protected]>