Patchwork [U-Boot,v3,2/4] SMDK6400: Fix some label undefined in build error

login
register
mail settings
Submitter seedshope
Date Jan. 13, 2011, 1:36 p.m.
Message ID <1294925784-5042-3-git-send-email-bocui107@gmail.com>
Download mbox | patch
Permalink /patch/78754/
State Rejected
Headers show

Comments

seedshope - Jan. 13, 2011, 1:36 p.m.
Modify Makefile for cpu_init.c and Start.s use some label,this defined
u-boot.lds of arch/arm/cpu/arm1176. But SMDK6400 use the link script
board/samsung/smdk6400/u-boot-nand.lds. So add some label form u-boot.lds
to u-boot-nand.lds

Signed-off-by: seedshope <bocui107@gmail.com>
Albert ARIBAUD - Jan. 13, 2011, 6:07 p.m.
Le 13/01/2011 14:36, seedshope a écrit :
> Modify Makefile for cpu_init.c and Start.s use some label,this defined
> u-boot.lds of arch/arm/cpu/arm1176. But SMDK6400 use the link script
> board/samsung/smdk6400/u-boot-nand.lds. So add some label form u-boot.lds
> to u-boot-nand.lds
>
> Signed-off-by: seedshope<bocui107@gmail.com>
>
> diff --git a/arch/arm/cpu/arm1176/s3c64xx/Makefile b/arch/arm/cpu/arm1176/s3c64xx/Makefile
> index 0785b19..f4b9574 100644
> --- a/arch/arm/cpu/arm1176/s3c64xx/Makefile
> +++ b/arch/arm/cpu/arm1176/s3c64xx/Makefile
> @@ -30,12 +30,15 @@ LIB	= $(obj)lib$(SOC).o
>
>   SOBJS	= reset.o
>
> -COBJS-$(CONFIG_S3C6400)	+= cpu_init.o speed.o
> +COBJS-$(CONFIG_S3C6400)	+= speed.o
>   COBJS-y	+= timer.o
>
> +CPUINIT	= cpu_init.o
> +
>   OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
> +CPUINIT := $(addprefix $(obj),$(CPUINIT))
>
> -all:	$(obj).depend $(START) $(LIB)
> +all:	$(obj).depend $(START) $(LIB) $(CPUINIT)
>
>   $(LIB):	$(OBJS)
>   	$(call cmd_link_o_target, $(OBJS))

Not sure I get what's the problem and how exactly this changes solves 
it. Can you detail this particular issue?

Amicalement,
seedshope - Jan. 14, 2011, 3:45 p.m.
On 01/14/2011 02:07 AM, Albert ARIBAUD wrote:
> Le 13/01/2011 14:36, seedshope a écrit :
>> Modify Makefile for cpu_init.c and Start.s use some label,this defined
>> u-boot.lds of arch/arm/cpu/arm1176. But SMDK6400 use the link script
>> board/samsung/smdk6400/u-boot-nand.lds. So add some label form 
>> u-boot.lds
>> to u-boot-nand.lds
>>
>> Signed-off-by: seedshope<bocui107@gmail.com>
>>
>> diff --git a/arch/arm/cpu/arm1176/s3c64xx/Makefile 
>> b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>> index 0785b19..f4b9574 100644
>> --- a/arch/arm/cpu/arm1176/s3c64xx/Makefile
>> +++ b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>> @@ -30,12 +30,15 @@ LIB    = $(obj)lib$(SOC).o
>>
>>   SOBJS    = reset.o
>>
>> -COBJS-$(CONFIG_S3C6400)    += cpu_init.o speed.o
>> +COBJS-$(CONFIG_S3C6400)    += speed.o
>>   COBJS-y    += timer.o
>>
>> +CPUINIT    = cpu_init.o
>> +
>>   OBJS    := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
>> +CPUINIT := $(addprefix $(obj),$(CPUINIT))
>>
>> -all:    $(obj).depend $(START) $(LIB)
>> +all:    $(obj).depend $(START) $(LIB) $(CPUINIT)
>>
>>   $(LIB):    $(OBJS)
>>       $(call cmd_link_o_target, $(OBJS))
>
> Not sure I get what's the problem and how exactly this changes solves 
> it. Can you detail this particular issue?
The issue is mem_ctrl_asm_init redefine in 
arch/arm/cpu/arm1176/s3c64xx/cpu_init.s.

At first, the link script file include cpu_init.s in 
board/samsung/smd6400/u-boot-nand.s, If I separate the cpu_init.o from 
COBJS-$(CONFIG_S3C6400), I guess cmd_link_o_target will deal with 
cpu_init.o. So the link script will double link the cpu_init file.

I have two method to solve it.
first: see the patch
second: Modify the link script

But I feel, the first method is safe.

I asked a question. I will RR on next, The patch1 and patch3 have 
already ok,  Do I only send patch2 and patch4?
>
> Amicalement,
seedshope - Jan. 14, 2011, 3:59 p.m.
On 01/14/2011 11:45 PM, seedshope wrote:
> On 01/14/2011 02:07 AM, Albert ARIBAUD wrote:
>> Le 13/01/2011 14:36, seedshope a écrit :
>>> Modify Makefile for cpu_init.c and Start.s use some label,this defined
>>> u-boot.lds of arch/arm/cpu/arm1176. But SMDK6400 use the link script
>>> board/samsung/smdk6400/u-boot-nand.lds. So add some label form 
>>> u-boot.lds
>>> to u-boot-nand.lds
>>>
>>> Signed-off-by: seedshope<bocui107@gmail.com>
>>>
>>> diff --git a/arch/arm/cpu/arm1176/s3c64xx/Makefile 
>>> b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>> index 0785b19..f4b9574 100644
>>> --- a/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>> +++ b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>> @@ -30,12 +30,15 @@ LIB    = $(obj)lib$(SOC).o
>>>
>>>   SOBJS    = reset.o
>>>
>>> -COBJS-$(CONFIG_S3C6400)    += cpu_init.o speed.o
>>> +COBJS-$(CONFIG_S3C6400)    += speed.o
>>>   COBJS-y    += timer.o
>>>
>>> +CPUINIT    = cpu_init.o
>>> +
>>>   OBJS    := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
>>> +CPUINIT := $(addprefix $(obj),$(CPUINIT))
>>>
>>> -all:    $(obj).depend $(START) $(LIB)
>>> +all:    $(obj).depend $(START) $(LIB) $(CPUINIT)
>>>
>>>   $(LIB):    $(OBJS)
>>>       $(call cmd_link_o_target, $(OBJS))
>>
>> Not sure I get what's the problem and how exactly this changes solves 
>> it. Can you detail this particular issue?
The part of u-boot-nand.lds as following:

         . = ALIGN(4);
         .text      :
         {
           arch/arm/cpu/arm1176/start.o  (.text)
           arch/arm/cpu/arm1176/s3c64xx/cpu_init.o       (.text)
           *(.text)
         }

I reference start.s to get the patch.;-)

Thanks,
seedshope
> The issue is mem_ctrl_asm_init redefine in 
> arch/arm/cpu/arm1176/s3c64xx/cpu_init.s.
>
> At first, the link script file include cpu_init.s in 
> board/samsung/smd6400/u-boot-nand.s, If I separate the cpu_init.o from 
> COBJS-$(CONFIG_S3C6400), I guess cmd_link_o_target will deal with 
> cpu_init.o. So the link script will double link the cpu_init file.
>
> I have two method to solve it.
> first: see the patch
> second: Modify the link script
>
> But I feel, the first method is safe.
>
> I asked a question. I will RR on next, The patch1 and patch3 have 
> already ok,  Do I only send patch2 and patch4?
>>
>> Amicalement,
>
Albert ARIBAUD - Jan. 14, 2011, 4:39 p.m.
Hi seedshope,

Le 14/01/2011 16:45, seedshope a écrit :
> On 01/14/2011 02:07 AM, Albert ARIBAUD wrote:
>> Le 13/01/2011 14:36, seedshope a écrit :
>>> Modify Makefile for cpu_init.c and Start.s use some label,this defined
>>> u-boot.lds of arch/arm/cpu/arm1176. But SMDK6400 use the link script
>>> board/samsung/smdk6400/u-boot-nand.lds. So add some label form
>>> u-boot.lds
>>> to u-boot-nand.lds
>>>
>>> Signed-off-by: seedshope<bocui107@gmail.com>
>>>
>>> diff --git a/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>> b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>> index 0785b19..f4b9574 100644
>>> --- a/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>> +++ b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>> @@ -30,12 +30,15 @@ LIB = $(obj)lib$(SOC).o
>>>
>>> SOBJS = reset.o
>>>
>>> -COBJS-$(CONFIG_S3C6400) += cpu_init.o speed.o
>>> +COBJS-$(CONFIG_S3C6400) += speed.o
>>> COBJS-y += timer.o
>>>
>>> +CPUINIT = cpu_init.o
>>> +
>>> OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
>>> +CPUINIT := $(addprefix $(obj),$(CPUINIT))
>>>
>>> -all: $(obj).depend $(START) $(LIB)
>>> +all: $(obj).depend $(START) $(LIB) $(CPUINIT)
>>>
>>> $(LIB): $(OBJS)
>>> $(call cmd_link_o_target, $(OBJS))
>>
>> Not sure I get what's the problem and how exactly this changes solves
>> it. Can you detail this particular issue?
> The issue is mem_ctrl_asm_init redefine in
> arch/arm/cpu/arm1176/s3c64xx/cpu_init.s.

 From what follows it seems the problem is rather cpu_init.o being 
linked in twice. Correct?

> At first, the link script file include cpu_init.s in
> board/samsung/smd6400/u-boot-nand.s, If I separate the cpu_init.o from
> COBJS-$(CONFIG_S3C6400), I guess cmd_link_o_target will deal with
> cpu_init.o. So the link script will double link the cpu_init file.

Then you should fix the double linking by i) determining why the double 
linking happens and ii) properly linking once only.

> I have two method to solve it.
> first: see the patch
> second: Modify the link script
>
> But I feel, the first method is safe.

It may be safe, but IIUC it does not properly address the issue and its 
root cause.

> I asked a question. I will RR on next, The patch1 and patch3 have
> already ok, Do I only send patch2 and patch4?

My personal practice is to re-send the whole patchset for each new 
version, because i) people can easily see the whole of the changes 
without having to go pick parts of previous versions and ii) it makes 
clear when a patch is removed or added to the set.

>> Amicalement,

Amicalement,
seedshope - Jan. 14, 2011, 4:56 p.m.
On 01/15/2011 12:39 AM, Albert ARIBAUD wrote:
> Hi seedshope,
>
> Le 14/01/2011 16:45, seedshope a écrit :
>> On 01/14/2011 02:07 AM, Albert ARIBAUD wrote:
>>> Le 13/01/2011 14:36, seedshope a écrit :
>>>> Modify Makefile for cpu_init.c and Start.s use some label,this defined
>>>> u-boot.lds of arch/arm/cpu/arm1176. But SMDK6400 use the link script
>>>> board/samsung/smdk6400/u-boot-nand.lds. So add some label form
>>>> u-boot.lds
>>>> to u-boot-nand.lds
>>>>
>>>> Signed-off-by: seedshope<bocui107@gmail.com>
>>>>
>>>> diff --git a/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>> b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>> index 0785b19..f4b9574 100644
>>>> --- a/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>> +++ b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>> @@ -30,12 +30,15 @@ LIB = $(obj)lib$(SOC).o
>>>>
>>>> SOBJS = reset.o
>>>>
>>>> -COBJS-$(CONFIG_S3C6400) += cpu_init.o speed.o
>>>> +COBJS-$(CONFIG_S3C6400) += speed.o
>>>> COBJS-y += timer.o
>>>>
>>>> +CPUINIT = cpu_init.o
>>>> +
>>>> OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
>>>> +CPUINIT := $(addprefix $(obj),$(CPUINIT))
>>>>
>>>> -all: $(obj).depend $(START) $(LIB)
>>>> +all: $(obj).depend $(START) $(LIB) $(CPUINIT)
>>>>
>>>> $(LIB): $(OBJS)
>>>> $(call cmd_link_o_target, $(OBJS))
>>>
>>> Not sure I get what's the problem and how exactly this changes solves
>>> it. Can you detail this particular issue?
>> The issue is mem_ctrl_asm_init redefine in
>> arch/arm/cpu/arm1176/s3c64xx/cpu_init.s.
>
> From what follows it seems the problem is rather cpu_init.o being 
> linked in twice. Correct?
maybe
>
>> At first, the link script file include cpu_init.s in
>> board/samsung/smd6400/u-boot-nand.s, If I separate the cpu_init.o from
>> COBJS-$(CONFIG_S3C6400), I guess cmd_link_o_target will deal with
>> cpu_init.o. So the link script will double link the cpu_init file.
>
> Then you should fix the double linking by i) determining why the 
> double linking happens and ii) properly linking once only.
Hi Alvert ARIBAUD,

I see the code for smdk6400. I found this code is very old. Before It 
can not add cmd_link_o_target in
Makefile(arch/arm/cpu/arm1176/s3c64xx/Makefile), The file will only to 
compile. So the link script is ok.

But, Now, It is not.  As far as I know, The linker script can do to link 
the first specified file for user.
Since I do not full understand the cmd_link_o_target mechanism. So I 
only guess the command do
some link work.

Maybe I am correct.


>
>> I have two method to solve it.
>> first: see the patch
>> second: Modify the link script
>>
>> But I feel, the first method is safe.
>
> It may be safe, but IIUC it does not properly address the issue and 
> its root cause.
yes
>
>> I asked a question. I will RR on next, The patch1 and patch3 have
>> already ok, Do I only send patch2 and patch4?
>
> My personal practice is to re-send the whole patchset for each new 
> version, because i) people can easily see the whole of the changes 
> without having to go pick parts of previous versions and ii) it makes 
> clear when a patch is removed or added to the set.
ok

Thanks,
seedshope
>
>>> Amicalement,
>
> Amicalement,
Albert ARIBAUD - Jan. 14, 2011, 6:15 p.m.
Le 14/01/2011 17:56, seedshope a écrit :
> On 01/15/2011 12:39 AM, Albert ARIBAUD wrote:
>> Hi seedshope,
>>
>> Le 14/01/2011 16:45, seedshope a écrit :
>>> On 01/14/2011 02:07 AM, Albert ARIBAUD wrote:
>>>> Le 13/01/2011 14:36, seedshope a écrit :
>>>>> Modify Makefile for cpu_init.c and Start.s use some label,this defined
>>>>> u-boot.lds of arch/arm/cpu/arm1176. But SMDK6400 use the link script
>>>>> board/samsung/smdk6400/u-boot-nand.lds. So add some label form
>>>>> u-boot.lds
>>>>> to u-boot-nand.lds
>>>>>
>>>>> Signed-off-by: seedshope<bocui107@gmail.com>
>>>>>
>>>>> diff --git a/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>>> b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>>> index 0785b19..f4b9574 100644
>>>>> --- a/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>>> +++ b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>>> @@ -30,12 +30,15 @@ LIB = $(obj)lib$(SOC).o
>>>>>
>>>>> SOBJS = reset.o
>>>>>
>>>>> -COBJS-$(CONFIG_S3C6400) += cpu_init.o speed.o
>>>>> +COBJS-$(CONFIG_S3C6400) += speed.o
>>>>> COBJS-y += timer.o
>>>>>
>>>>> +CPUINIT = cpu_init.o
>>>>> +
>>>>> OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
>>>>> +CPUINIT := $(addprefix $(obj),$(CPUINIT))
>>>>>
>>>>> -all: $(obj).depend $(START) $(LIB)
>>>>> +all: $(obj).depend $(START) $(LIB) $(CPUINIT)
>>>>>
>>>>> $(LIB): $(OBJS)
>>>>> $(call cmd_link_o_target, $(OBJS))
>>>>
>>>> Not sure I get what's the problem and how exactly this changes solves
>>>> it. Can you detail this particular issue?
>>> The issue is mem_ctrl_asm_init redefine in
>>> arch/arm/cpu/arm1176/s3c64xx/cpu_init.s.
>>
>> From what follows it seems the problem is rather cpu_init.o being
>> linked in twice. Correct?
> maybe
>>
>>> At first, the link script file include cpu_init.s in
>>> board/samsung/smd6400/u-boot-nand.s, If I separate the cpu_init.o from
>>> COBJS-$(CONFIG_S3C6400), I guess cmd_link_o_target will deal with
>>> cpu_init.o. So the link script will double link the cpu_init file.
>>
>> Then you should fix the double linking by i) determining why the
>> double linking happens and ii) properly linking once only.
> Hi Alvert ARIBAUD,
>
> I see the code for smdk6400. I found this code is very old. Before It
> can not add cmd_link_o_target in
> Makefile(arch/arm/cpu/arm1176/s3c64xx/Makefile), The file will only to
> compile. So the link script is ok.
>
> But, Now, It is not. As far as I know, The linker script can do to link
> the first specified file for user.
> Since I do not full understand the cmd_link_o_target mechanism. So I
> only guess the command do
> some link work.
>
> Maybe I am correct.

I don't want to accept this change on the off chance that it might be 
correct; before your next patch submission, please try building your 
code without this specific patch and positively find why the build fails.

Amicalement,
seedshope - Jan. 14, 2011, 6:45 p.m.
On 01/15/2011 02:15 AM, Albert ARIBAUD wrote:
> Le 14/01/2011 17:56, seedshope a écrit :
>> On 01/15/2011 12:39 AM, Albert ARIBAUD wrote:
>>> Hi seedshope,
>>>
>>> Le 14/01/2011 16:45, seedshope a écrit :
>>>> On 01/14/2011 02:07 AM, Albert ARIBAUD wrote:
>>>>> Le 13/01/2011 14:36, seedshope a écrit :
>>>>>> Modify Makefile for cpu_init.c and Start.s use some label,this 
>>>>>> defined
>>>>>> u-boot.lds of arch/arm/cpu/arm1176. But SMDK6400 use the link script
>>>>>> board/samsung/smdk6400/u-boot-nand.lds. So add some label form
>>>>>> u-boot.lds
>>>>>> to u-boot-nand.lds
>>>>>>
>>>>>> Signed-off-by: seedshope<bocui107@gmail.com>
>>>>>>
>>>>>> diff --git a/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>>>> b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>>>> index 0785b19..f4b9574 100644
>>>>>> --- a/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>>>> +++ b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>>>> @@ -30,12 +30,15 @@ LIB = $(obj)lib$(SOC).o
>>>>>>
>>>>>> SOBJS = reset.o
>>>>>>
>>>>>> -COBJS-$(CONFIG_S3C6400) += cpu_init.o speed.o
>>>>>> +COBJS-$(CONFIG_S3C6400) += speed.o
>>>>>> COBJS-y += timer.o
>>>>>>
>>>>>> +CPUINIT = cpu_init.o
>>>>>> +
>>>>>> OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
>>>>>> +CPUINIT := $(addprefix $(obj),$(CPUINIT))
>>>>>>
>>>>>> -all: $(obj).depend $(START) $(LIB)
>>>>>> +all: $(obj).depend $(START) $(LIB) $(CPUINIT)
>>>>>>
>>>>>> $(LIB): $(OBJS)
>>>>>> $(call cmd_link_o_target, $(OBJS))
>>>>>
>>>>> Not sure I get what's the problem and how exactly this changes solves
>>>>> it. Can you detail this particular issue?
>>>> The issue is mem_ctrl_asm_init redefine in
>>>> arch/arm/cpu/arm1176/s3c64xx/cpu_init.s.
>>>
>>> From what follows it seems the problem is rather cpu_init.o being
>>> linked in twice. Correct?
>> maybe
>>>
>>>> At first, the link script file include cpu_init.s in
>>>> board/samsung/smd6400/u-boot-nand.s, If I separate the cpu_init.o from
>>>> COBJS-$(CONFIG_S3C6400), I guess cmd_link_o_target will deal with
>>>> cpu_init.o. So the link script will double link the cpu_init file.
>>>
>>> Then you should fix the double linking by i) determining why the
>>> double linking happens and ii) properly linking once only.
>> Hi Alvert ARIBAUD,
>>
>> I see the code for smdk6400. I found this code is very old. Before It
>> can not add cmd_link_o_target in
>> Makefile(arch/arm/cpu/arm1176/s3c64xx/Makefile), The file will only to
>> compile. So the link script is ok.
>>
>> But, Now, It is not. As far as I know, The linker script can do to link
>> the first specified file for user.
>> Since I do not full understand the cmd_link_o_target mechanism. So I
>> only guess the command do
>> some link work.
>>
>> Maybe I am correct.
>
> I don't want to accept this change on the off chance that it might be 
> correct; before your next patch submission, please try building your 
> code without this specific patch and positively find why the build fails.
ok,

Thanks
seedshope
>
> Amicalement,
seedshope - Jan. 19, 2011, 2:25 p.m.
On 01/15/2011 02:15 AM, Albert ARIBAUD wrote:
> Le 14/01/2011 17:56, seedshope a écrit :
>> On 01/15/2011 12:39 AM, Albert ARIBAUD wrote:
>>> Hi seedshope,
>>>
>>> Le 14/01/2011 16:45, seedshope a écrit :
>>>> On 01/14/2011 02:07 AM, Albert ARIBAUD wrote:
>>>>> Le 13/01/2011 14:36, seedshope a écrit :
>>>>>> Modify Makefile for cpu_init.c and Start.s use some label,this 
>>>>>> defined
>>>>>> u-boot.lds of arch/arm/cpu/arm1176. But SMDK6400 use the link script
>>>>>> board/samsung/smdk6400/u-boot-nand.lds. So add some label form
>>>>>> u-boot.lds
>>>>>> to u-boot-nand.lds
>>>>>>
>>>>>> Signed-off-by: seedshope<bocui107@gmail.com>
>>>>>>
>>>>>> diff --git a/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>>>> b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>>>> index 0785b19..f4b9574 100644
>>>>>> --- a/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>>>> +++ b/arch/arm/cpu/arm1176/s3c64xx/Makefile
>>>>>> @@ -30,12 +30,15 @@ LIB = $(obj)lib$(SOC).o
>>>>>>
>>>>>> SOBJS = reset.o
>>>>>>
>>>>>> -COBJS-$(CONFIG_S3C6400) += cpu_init.o speed.o
>>>>>> +COBJS-$(CONFIG_S3C6400) += speed.o
>>>>>> COBJS-y += timer.o
>>>>>>
>>>>>> +CPUINIT = cpu_init.o
>>>>>> +
>>>>>> OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
>>>>>> +CPUINIT := $(addprefix $(obj),$(CPUINIT))
>>>>>>
>>>>>> -all: $(obj).depend $(START) $(LIB)
>>>>>> +all: $(obj).depend $(START) $(LIB) $(CPUINIT)
>>>>>>
>>>>>> $(LIB): $(OBJS)
>>>>>> $(call cmd_link_o_target, $(OBJS))
>>>>>
>>>>> Not sure I get what's the problem and how exactly this changes solves
>>>>> it. Can you detail this particular issue?
>>>> The issue is mem_ctrl_asm_init redefine in
>>>> arch/arm/cpu/arm1176/s3c64xx/cpu_init.s.
>>>
>>> From what follows it seems the problem is rather cpu_init.o being
>>> linked in twice. Correct?
>> maybe
>>>
>>>> At first, the link script file include cpu_init.s in
>>>> board/samsung/smd6400/u-boot-nand.s, If I separate the cpu_init.o from
>>>> COBJS-$(CONFIG_S3C6400), I guess cmd_link_o_target will deal with
>>>> cpu_init.o. So the link script will double link the cpu_init file.
>>>
>>> Then you should fix the double linking by i) determining why the
>>> double linking happens and ii) properly linking once only.
>> Hi Alvert ARIBAUD,
>>
>> I see the code for smdk6400. I found this code is very old. Before It
>> can not add cmd_link_o_target in
>> Makefile(arch/arm/cpu/arm1176/s3c64xx/Makefile), The file will only to
>> compile. So the link script is ok.
>>
>> But, Now, It is not. As far as I know, The linker script can do to link
>> the first specified file for user.
>> Since I do not full understand the cmd_link_o_target mechanism. So I
>> only guess the command do
>> some link work.
>>
>> Maybe I am correct.
>
> I don't want to accept this change on the off chance that it might be 
> correct; before your next patch submission, please try building your 
> code without this specific patch and positively find why the build fails.
Hi Amicalement

I trace the issue, I find cmd_link_o_target will link the cpu_init.o file.
If I add the file to u-boot-nand.lds file, The file will be link twice.

Now, It is good method to delete the file in u-boot-nand.s. Why? Before I
think Nand Booting for the 4kb, If you don't link the file to the first 
4kB, the system
will be generate error. Because the mem initialization function will 
can't find.

But , Now , The nand booting will be generate in nand_spl, the generate 
u-boot img is limit for 4KB,
So this is ok.

Do you think about?

Thanks,
seedshope
>
> Amicalement,

Patch

diff --git a/arch/arm/cpu/arm1176/s3c64xx/Makefile b/arch/arm/cpu/arm1176/s3c64xx/Makefile
index 0785b19..f4b9574 100644
--- a/arch/arm/cpu/arm1176/s3c64xx/Makefile
+++ b/arch/arm/cpu/arm1176/s3c64xx/Makefile
@@ -30,12 +30,15 @@  LIB	= $(obj)lib$(SOC).o
 
 SOBJS	= reset.o
 
-COBJS-$(CONFIG_S3C6400)	+= cpu_init.o speed.o
+COBJS-$(CONFIG_S3C6400)	+= speed.o
 COBJS-y	+= timer.o
 
+CPUINIT	= cpu_init.o
+
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+CPUINIT := $(addprefix $(obj),$(CPUINIT))
 
-all:	$(obj).depend $(START) $(LIB)
+all:	$(obj).depend $(START) $(LIB) $(CPUINIT)
 
 $(LIB):	$(OBJS)
 	$(call cmd_link_o_target, $(OBJS))
diff --git a/board/samsung/smdk6400/u-boot-nand.lds b/board/samsung/smdk6400/u-boot-nand.lds
index 29a4f61..2b87fc6 100644
--- a/board/samsung/smdk6400/u-boot-nand.lds
+++ b/board/samsung/smdk6400/u-boot-nand.lds
@@ -55,8 +55,29 @@  SECTIONS
 	. = ALIGN(4);
 	.mmudata : { *(.mmudata) }
 
-	. = ALIGN(4);
-	__bss_start = .;
-	.bss : { *(.bss) . = ALIGN(4); }
-	_end = .;
+        . = ALIGN(4);
+
+	.rel.dyn : {
+		__rel_dyn_start = .;
+		*(.rel*)
+		__rel_dyn_end = .;
+	}
+
+	.dynsym : {
+		__dynsym_start = .;
+		*(.dynsym)
+	}
+
+	.bss __rel_dyn_start (OVERLAY) : {
+		__bss_start = .;
+		*(.bss)
+		. = ALIGN(4);
+		_end = .;
+	}
+
+	/DISCARD/ : { *(.dynstr*) }
+	/DISCARD/ : { *(.dynamic*) }
+	/DISCARD/ : { *(.plt*) }
+	/DISCARD/ : { *(.interp*) }
+	/DISCARD/ : { *(.gnu*) }
 }