[U-Boot] [PATCH 1/1] at91: use pre-built object to avoid weak function problem

add weak lowlel_init
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com --- config.mk | 3 +++ cpu/arm926ejs/at91/Makefile | 2 +- cpu/arm926ejs/at91/lowlevel_init.S | 2 ++ 3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/config.mk b/config.mk index b1254e9..94b8c7c 100644 --- a/config.mk +++ b/config.mk @@ -76,6 +76,9 @@ STRIP = $(CROSS_COMPILE)strip OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump RANLIB = $(CROSS_COMPILE)RANLIB +cmd_link_o_target = $(if $(strip $(2)),\ + $(LD) $(PLATFORM_LDFLAGS) -r -o $(1) $(2) ,\ + rm -f $@; $(AR) rcs $(1))
#########################################################################
diff --git a/cpu/arm926ejs/at91/Makefile b/cpu/arm926ejs/at91/Makefile index 2d2a888..662657c 100644 --- a/cpu/arm926ejs/at91/Makefile +++ b/cpu/arm926ejs/at91/Makefile @@ -36,7 +36,7 @@ OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y)) all: $(obj).depend $(LIB)
$(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $@, $(OBJS))
#########################################################################
diff --git a/cpu/arm926ejs/at91/lowlevel_init.S b/cpu/arm926ejs/at91/lowlevel_init.S index ec6ad5d..54b3f3d 100644 --- a/cpu/arm926ejs/at91/lowlevel_init.S +++ b/cpu/arm926ejs/at91/lowlevel_init.S @@ -30,6 +30,8 @@ #ifndef CONFIG_SKIP_LOWLEVEL_INIT
.globl lowlevel_init +.weak lowlevel_init +.set lowlevel_init,function lowlevel_init:
/*

Dear Jean-Christophe PLAGNIOL-VILLARD,
In message 1233510496-26329-1-git-send-email-plagnioj@jcrosoft.com you wrote:
add weak lowlel_init
What does "lowlel" mean?
You definitely want to add a more descriptive comment here waht you are doing, why you are doing it, and why you are doing it this way.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com
config.mk | 3 +++ cpu/arm926ejs/at91/Makefile | 2 +- cpu/arm926ejs/at91/lowlevel_init.S | 2 ++ 3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/config.mk b/config.mk index b1254e9..94b8c7c 100644 --- a/config.mk +++ b/config.mk @@ -76,6 +76,9 @@ STRIP = $(CROSS_COMPILE)strip OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump RANLIB = $(CROSS_COMPILE)RANLIB +cmd_link_o_target = $(if $(strip $(2)),\
$(LD) $(PLATFORM_LDFLAGS) -r -o $(1) $(2) ,\
rm -f $@; $(AR) rcs $(1))
Please make sure to use $(STRIP) instead of 'strip', and $ARFLAGS) instead of 'rcs'
#########################################################################
diff --git a/cpu/arm926ejs/at91/Makefile b/cpu/arm926ejs/at91/Makefile index 2d2a888..662657c 100644 --- a/cpu/arm926ejs/at91/Makefile +++ b/cpu/arm926ejs/at91/Makefile @@ -36,7 +36,7 @@ OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y)) all: $(obj).depend $(LIB)
$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
- $(call cmd_link_o_target, $@, $(OBJS))
#########################################################################
diff --git a/cpu/arm926ejs/at91/lowlevel_init.S b/cpu/arm926ejs/at91/lowlevel_init.S index ec6ad5d..54b3f3d 100644 --- a/cpu/arm926ejs/at91/lowlevel_init.S +++ b/cpu/arm926ejs/at91/lowlevel_init.S @@ -30,6 +30,8 @@ #ifndef CONFIG_SKIP_LOWLEVEL_INIT
.globl lowlevel_init +.weak lowlevel_init +.set lowlevel_init,function lowlevel_init:
If this change is needed for AT91 only, then cmd_link_o_target should not be added to the global config.mk - why not add it to cpu/arm926ejs/at91/config.mk ?
Best regards,
Wolfgang Denk

On Sun, Feb 1, 2009 at 2:25 PM, Wolfgang Denk wrote:
In message Jean-Christophe PLAGNIOL-VILLARD you wrote:
+cmd_link_o_target = $(if $(strip $(2)),\
$(LD) $(PLATFORM_LDFLAGS) -r -o $(1) $(2) ,\
rm -f $@; $(AR) rcs $(1))
Please make sure to use $(STRIP) instead of 'strip'
this is make $(strip ...), not toolchain $(STRIP) -mike

Dear Mike Frysinger,
In message 1aad82fa0902011133qfd957b0ge41b03cfbd99749b@mail.gmail.com you wrote:
+cmd_link_o_target = $(if $(strip $(2)),\
$(LD) $(PLATFORM_LDFLAGS) -r -o $(1) $(2) ,\
rm -f $@; $(AR) rcs $(1))
Please make sure to use $(STRIP) instead of 'strip'
this is make $(strip ...), not toolchain $(STRIP)
Please elucidate?
Best regards,
Wolfgang Denk

On Sun, Feb 1, 2009 at 3:06 PM, Wolfgang Denk wrote:
In message Mike Frysinger you wrote:
+cmd_link_o_target = $(if $(strip $(2)),\
$(LD) $(PLATFORM_LDFLAGS) -r -o $(1) $(2) ,\
rm -f $@; $(AR) rcs $(1))
Please make sure to use $(STRIP) instead of 'strip'
this is make $(strip ...), not toolchain $(STRIP)
Please elucidate?
http://www.gnu.org/software/make/manual/html_node/Text-Functions.html#Text-F... -mike

Dear Mike Frysinger,
In message 1aad82fa0902011209t5c1251fbm6f544c6207e9d779@mail.gmail.com you wrote:
On Sun, Feb 1, 2009 at 3:06 PM, Wolfgang Denk wrote:
In message Mike Frysinger you wrote:
+cmd_link_o_target = $(if $(strip $(2)),\
$(LD) $(PLATFORM_LDFLAGS) -r -o $(1) $(2) ,\
rm -f $@; $(AR) rcs $(1))
Please make sure to use $(STRIP) instead of 'strip'
this is make $(strip ...), not toolchain $(STRIP)
Please elucidate?
http://www.gnu.org/software/make/manual/html_node/Text-Functions.html#Text-F...
I see. Thanks.
Best regards,
Wolfgang Denk

due to asm weak function link overwrite problem use pre-built object instead of library.
You will need to build the lib$(BOARD).a the same way
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com --- The asm weak overwrite link problem have been found also present on other arm And supposed on other arch
the the AR do not use the $(ARFLAGS) because in this case we will have no file as param to generate the library
Best Regards, J. config.mk | 3 +++ cpu/arm926ejs/at91/Makefile | 2 +- cpu/arm926ejs/at91/lowlevel_init.S | 2 ++ 3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/config.mk b/config.mk index b1254e9..94b8c7c 100644 --- a/config.mk +++ b/config.mk @@ -76,6 +76,9 @@ STRIP = $(CROSS_COMPILE)strip OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump RANLIB = $(CROSS_COMPILE)RANLIB +cmd_link_o_target = $(if $(strip $(2)),\ + $(LD) $(PLATFORM_LDFLAGS) -r -o $(1) $(2) ,\ + rm -f $@; $(AR) rcs $(1))
#########################################################################
diff --git a/cpu/arm926ejs/at91/Makefile b/cpu/arm926ejs/at91/Makefile index 2d2a888..662657c 100644 --- a/cpu/arm926ejs/at91/Makefile +++ b/cpu/arm926ejs/at91/Makefile @@ -36,7 +36,7 @@ OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y)) all: $(obj).depend $(LIB)
$(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $@, $(OBJS))
#########################################################################
diff --git a/cpu/arm926ejs/at91/lowlevel_init.S b/cpu/arm926ejs/at91/lowlevel_init.S index ec6ad5d..54b3f3d 100644 --- a/cpu/arm926ejs/at91/lowlevel_init.S +++ b/cpu/arm926ejs/at91/lowlevel_init.S @@ -30,6 +30,8 @@ #ifndef CONFIG_SKIP_LOWLEVEL_INIT
.globl lowlevel_init +.weak lowlevel_init +.set lowlevel_init,function lowlevel_init:
/*

Dear Jean-Christophe PLAGNIOL-VILLARD,
In message 1233782242-3760-1-git-send-email-plagnioj@jcrosoft.com you wrote:
due to asm weak function link overwrite problem use pre-built object instead of library.
Or use a correct linker script that makes sure the needed objects get pulled in by the linker before it attempts to resolve references from the libraries.
Best regards,
Wolfgang Denk
participants (3)
-
Jean-Christophe PLAGNIOL-VILLARD
-
Mike Frysinger
-
Wolfgang Denk