public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] at91: use pre-built object to avoid weak function problem
@ 2009-02-01 17:48 Jean-Christophe PLAGNIOL-VILLARD
  2009-02-01 19:25 ` Wolfgang Denk
  2009-02-04 21:17 ` [U-Boot] [PATCH V2] at91: allow the lowlevel_init to be overwrite by the board Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 8+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-02-01 17:48 UTC (permalink / raw)
  To: u-boot

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:
 
 	/*
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/1] at91: use pre-built object to avoid weak function problem
  2009-02-01 17:48 [U-Boot] [PATCH 1/1] at91: use pre-built object to avoid weak function problem Jean-Christophe PLAGNIOL-VILLARD
@ 2009-02-01 19:25 ` Wolfgang Denk
  2009-02-01 19:33   ` Mike Frysinger
  2009-02-04 21:17 ` [U-Boot] [PATCH V2] at91: allow the lowlevel_init to be overwrite by the board Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2009-02-01 19:25 UTC (permalink / raw)
  To: u-boot

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

-- 
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
Diplomacy is the art of saying "nice doggy" until you can find a rock.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/1] at91: use pre-built object to avoid weak function problem
  2009-02-01 19:25 ` Wolfgang Denk
@ 2009-02-01 19:33   ` Mike Frysinger
  2009-02-01 20:06     ` Wolfgang Denk
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2009-02-01 19:33 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/1] at91: use pre-built object to avoid weak function problem
  2009-02-01 19:33   ` Mike Frysinger
@ 2009-02-01 20:06     ` Wolfgang Denk
  2009-02-01 20:09       ` Mike Frysinger
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2009-02-01 20:06 UTC (permalink / raw)
  To: u-boot

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

-- 
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
When a man sits with a pretty girl for  an  hour,  it  seems  like  a
minute.  But let him sit on a hot stove for a minute -- and it's lon-
ger than any hour. That's relativity.              -- Albert Einstein

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/1] at91: use pre-built object to avoid weak function problem
  2009-02-01 20:06     ` Wolfgang Denk
@ 2009-02-01 20:09       ` Mike Frysinger
  2009-02-01 20:23         ` Wolfgang Denk
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2009-02-01 20:09 UTC (permalink / raw)
  To: u-boot

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-Functions
-mike

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/1] at91: use pre-built object to avoid weak function problem
  2009-02-01 20:09       ` Mike Frysinger
@ 2009-02-01 20:23         ` Wolfgang Denk
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfgang Denk @ 2009-02-01 20:23 UTC (permalink / raw)
  To: u-boot

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-Functions

I see. Thanks.

Best regards,

Wolfgang Denk

-- 
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
Violence in reality is quite different from theory.
	-- Spock, "The Cloud Minders", stardate 5818.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH V2] at91: allow the lowlevel_init to be overwrite by the board
  2009-02-01 17:48 [U-Boot] [PATCH 1/1] at91: use pre-built object to avoid weak function problem Jean-Christophe PLAGNIOL-VILLARD
  2009-02-01 19:25 ` Wolfgang Denk
@ 2009-02-04 21:17 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-02-04 21:25   ` Wolfgang Denk
  1 sibling, 1 reply; 8+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-02-04 21:17 UTC (permalink / raw)
  To: u-boot

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:
 
 	/*
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH V2] at91: allow the lowlevel_init to be overwrite by the board
  2009-02-04 21:17 ` [U-Boot] [PATCH V2] at91: allow the lowlevel_init to be overwrite by the board Jean-Christophe PLAGNIOL-VILLARD
@ 2009-02-04 21:25   ` Wolfgang Denk
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfgang Denk @ 2009-02-04 21:25 UTC (permalink / raw)
  To: u-boot

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

-- 
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
Killing is wrong.
	-- Losira, "That Which Survives", stardate unknown

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-02-04 21:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-01 17:48 [U-Boot] [PATCH 1/1] at91: use pre-built object to avoid weak function problem Jean-Christophe PLAGNIOL-VILLARD
2009-02-01 19:25 ` Wolfgang Denk
2009-02-01 19:33   ` Mike Frysinger
2009-02-01 20:06     ` Wolfgang Denk
2009-02-01 20:09       ` Mike Frysinger
2009-02-01 20:23         ` Wolfgang Denk
2009-02-04 21:17 ` [U-Boot] [PATCH V2] at91: allow the lowlevel_init to be overwrite by the board Jean-Christophe PLAGNIOL-VILLARD
2009-02-04 21:25   ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox