No subject


Fri Jan 23 11:48:37 CET 2009


INCLUDE filename
    Include the linker script filename at this point. The file will be
searched for in the current directory, and in any directory specified with
the -L option. You can nest calls to INCLUDE up to 10 levels deep.

and the additional PLATFORM_LIBS does add -L
/home/graeme/Source/U-Boot/x86/board/eNET to the link command. I even tried
PLATFORM_LDFLAGS += -L $(SRCTREE)/board/$(BOARDDIR) which changes the
location of the addition -L in the link command with no luck.

Back to binutils documentation:

-T scriptfile
--script=scriptfile
    Use scriptfile as the linker script. This script replaces ld's default
linker script (rather than adding to it), so commandfile must specify
everything necessary to describe the output file. See Scripts. If
scriptfile does not exist in the current directory, ld looks for it in the
directories specified by any preceding `-L' options. Multiple `-T' options
accumulate.

Note the last sentence "Multiple `-T' options accumulate."

Now if I change $(SRCTREE)/config.mk slightly at around line 205 to add an
Implicit Linker Script...

AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
LDFLAGS += -T $(SRCTREE)/board/$(BOARDDIR)/board_defs.lds
LDFLAGS += -Bstatic -T $(obj)u-boot.lds $(PLATFORM_LDFLAGS)
ifneq ($(TEXT_BASE),)
LDFLAGS += -Ttext $(TEXT_BASE)
endif

Everything works perfectly fine. But this is a horrible hack. Alas, there
is no mechanism right now to add ld flags before the ones explicitly
defined in config.mk.

Unless I can find out why -L is not working, I'm thinking of adding a new
$(PLATFORM_PRE_LDFLAGS) and changing $(SRCTREE)/config.mk to:

LDFLAGS += $(PLATFORM_PRE_LDFLAGS) -Bstatic -T $(obj)u-boot.lds
$(PLATFORM_LDFLAGS)

I could also but some hacks into the $(BOARD)_config in the Makefile to
patch the linker script but I think that is a bad idea.

Or maybe there is an easier way?

Anyone have any thoughts on this?

Regards,

Graeme


More information about the U-Boot mailing list