diff mbox

[U-Boot,2/2] SPL: Allow ARM926EJS to avoid compiling in the CPU support code

Message ID 1317860006-18212-2-git-send-email-marek.vasut@gmail.com
State Superseded
Headers show

Commit Message

Marek Vasut Oct. 6, 2011, 12:13 a.m. UTC
This allows the SPL to avoid compiling in the CPU support code.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
Cc: Scott Wood <scottwood@freescale.com>
---
 arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Comments

Albert ARIBAUD Oct. 18, 2011, 9:33 p.m. UTC | #1
Hi Marek,

Le 06/10/2011 02:13, Marek Vasut a écrit :
> This allows the SPL to avoid compiling in the CPU support code.
>
> Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
> Cc: Stefano Babic<sbabic@denx.de>
> Cc: Wolfgang Denk<wd@denx.de>
> Cc: Detlev Zundel<dzu@denx.de>
> Cc: Scott Wood<scottwood@freescale.com>
> ---
>   arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
>   1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/cpu/arm926ejs/Makefile b/arch/arm/cpu/arm926ejs/Makefile
> index 930e0d1..3f9b0f1 100644
> --- a/arch/arm/cpu/arm926ejs/Makefile
> +++ b/arch/arm/cpu/arm926ejs/Makefile
> @@ -28,6 +28,13 @@ LIB	= $(obj)lib$(CPU).o
>   START	= start.o
>   COBJS	= cpu.o
>
> +ifdef	CONFIG_SPL_BUILD
> +ifdef	CONFIG_SPL_NO_CPU_SUPPORT_CODE
> +START	:=
> +COBJS	:=
> +endif
> +endif
> +
>   SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
>   OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
>   START	:= $(addprefix $(obj),$(START))

cpu.c basically contains one cache management function and one 
linux-boot-related function probably better suited in bootm... Rather 
than adding a config option to avoid compiling cpu.c, should we not 
simply move the functions where they belong?

Amicalement,
Marek Vasut Oct. 18, 2011, 10:30 p.m. UTC | #2
On Tuesday, October 18, 2011 11:33:59 PM Albert ARIBAUD wrote:
> Hi Marek,
> 
> Le 06/10/2011 02:13, Marek Vasut a écrit :
> > This allows the SPL to avoid compiling in the CPU support code.
> > 
> > Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
> > Cc: Stefano Babic<sbabic@denx.de>
> > Cc: Wolfgang Denk<wd@denx.de>
> > Cc: Detlev Zundel<dzu@denx.de>
> > Cc: Scott Wood<scottwood@freescale.com>
> > ---
> > 
> >   arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
> >   1 files changed, 7 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/arm/cpu/arm926ejs/Makefile
> > b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
> > --- a/arch/arm/cpu/arm926ejs/Makefile
> > +++ b/arch/arm/cpu/arm926ejs/Makefile
> > @@ -28,6 +28,13 @@ LIB	= $(obj)lib$(CPU).o
> > 
> >   START	= start.o
> >   COBJS	= cpu.o
> > 
> > +ifdef	CONFIG_SPL_BUILD
> > +ifdef	CONFIG_SPL_NO_CPU_SUPPORT_CODE
> > +START	:=
> > +COBJS	:=
> > +endif
> > +endif
> > +
> > 
> >   SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
> >   OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
> >   START	:= $(addprefix $(obj),$(START))
> 
> cpu.c basically contains one cache management function and one
> linux-boot-related function probably better suited in bootm... Rather
> than adding a config option to avoid compiling cpu.c, should we not
> simply move the functions where they belong?

I expect the cache management functions to be moved with the ARM926 cache stuff 
by Hong ... though there is not much activity recently :-(

> 
> Amicalement,
Marek Vasut Oct. 21, 2011, 8:44 p.m. UTC | #3
On Thursday, October 06, 2011 02:13:26 AM Marek Vasut wrote:
> This allows the SPL to avoid compiling in the CPU support code.
> 
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Detlev Zundel <dzu@denx.de>
> Cc: Scott Wood <scottwood@freescale.com>
> ---
>  arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/Makefile
> b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
> --- a/arch/arm/cpu/arm926ejs/Makefile
> +++ b/arch/arm/cpu/arm926ejs/Makefile
> @@ -28,6 +28,13 @@ LIB	= $(obj)lib$(CPU).o
>  START	= start.o
>  COBJS	= cpu.o
> 
> +ifdef	CONFIG_SPL_BUILD
> +ifdef	CONFIG_SPL_NO_CPU_SUPPORT_CODE
> +START	:=
> +COBJS	:=
> +endif
> +endif
> +
>  SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
>  OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
>  START	:= $(addprefix $(obj),$(START))

Hi Albert,

can we get this applied please?

Cheers
Albert ARIBAUD Oct. 21, 2011, 9:52 p.m. UTC | #4
Hi Marek,

Le 21/10/2011 22:44, Marek Vasut a écrit :
> On Thursday, October 06, 2011 02:13:26 AM Marek Vasut wrote:
>> This allows the SPL to avoid compiling in the CPU support code.
>>
>> Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
>> Cc: Stefano Babic<sbabic@denx.de>
>> Cc: Wolfgang Denk<wd@denx.de>
>> Cc: Detlev Zundel<dzu@denx.de>
>> Cc: Scott Wood<scottwood@freescale.com>
>> ---
>>   arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
>>   1 files changed, 7 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/cpu/arm926ejs/Makefile
>> b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
>> --- a/arch/arm/cpu/arm926ejs/Makefile
>> +++ b/arch/arm/cpu/arm926ejs/Makefile
>> @@ -28,6 +28,13 @@ LIB	= $(obj)lib$(CPU).o
>>   START	= start.o
>>   COBJS	= cpu.o
>>
>> +ifdef	CONFIG_SPL_BUILD
>> +ifdef	CONFIG_SPL_NO_CPU_SUPPORT_CODE
>> +START	:=
>> +COBJS	:=
>> +endif
>> +endif
>> +
>>   SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
>>   OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
>>   START	:= $(addprefix $(obj),$(START))
>
> Hi Albert,
>
> can we get this applied please?

I still don't understand what this is supposed to do -- why not linking 
this code is required.

Amicalement,
Marek Vasut Oct. 21, 2011, 10 p.m. UTC | #5
On Friday, October 21, 2011 11:52:23 PM Albert ARIBAUD wrote:
> Hi Marek,
> 
> Le 21/10/2011 22:44, Marek Vasut a écrit :
> > On Thursday, October 06, 2011 02:13:26 AM Marek Vasut wrote:
> >> This allows the SPL to avoid compiling in the CPU support code.
> >> 
> >> Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
> >> Cc: Stefano Babic<sbabic@denx.de>
> >> Cc: Wolfgang Denk<wd@denx.de>
> >> Cc: Detlev Zundel<dzu@denx.de>
> >> Cc: Scott Wood<scottwood@freescale.com>
> >> ---
> >> 
> >>   arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
> >>   1 files changed, 7 insertions(+), 0 deletions(-)
> >> 
> >> diff --git a/arch/arm/cpu/arm926ejs/Makefile
> >> b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
> >> --- a/arch/arm/cpu/arm926ejs/Makefile
> >> +++ b/arch/arm/cpu/arm926ejs/Makefile
> >> @@ -28,6 +28,13 @@ LIB	= $(obj)lib$(CPU).o
> >> 
> >>   START	= start.o
> >>   COBJS	= cpu.o
> >> 
> >> +ifdef	CONFIG_SPL_BUILD
> >> +ifdef	CONFIG_SPL_NO_CPU_SUPPORT_CODE
> >> +START	:=
> >> +COBJS	:=
> >> +endif
> >> +endif
> >> +
> >> 
> >>   SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
> >>   OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
> >>   START	:= $(addprefix $(obj),$(START))
> > 
> > Hi Albert,
> > 
> > can we get this applied please?
> 
> I still don't understand what this is supposed to do -- why not linking
> this code is required.
> 
> Amicalement,

Hi Albert,

I use very different start.S in SPL. And I don't need cpu.o at all.

Cheers
Albert ARIBAUD Oct. 21, 2011, 10:44 p.m. UTC | #6
Le 22/10/2011 00:00, Marek Vasut a écrit :
> On Friday, October 21, 2011 11:52:23 PM Albert ARIBAUD wrote:
>> Hi Marek,
>>
>> Le 21/10/2011 22:44, Marek Vasut a écrit :
>>> On Thursday, October 06, 2011 02:13:26 AM Marek Vasut wrote:
>>>> This allows the SPL to avoid compiling in the CPU support code.
>>>>
>>>> Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
>>>> Cc: Stefano Babic<sbabic@denx.de>
>>>> Cc: Wolfgang Denk<wd@denx.de>
>>>> Cc: Detlev Zundel<dzu@denx.de>
>>>> Cc: Scott Wood<scottwood@freescale.com>
>>>> ---
>>>>
>>>>    arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
>>>>    1 files changed, 7 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/arch/arm/cpu/arm926ejs/Makefile
>>>> b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
>>>> --- a/arch/arm/cpu/arm926ejs/Makefile
>>>> +++ b/arch/arm/cpu/arm926ejs/Makefile
>>>> @@ -28,6 +28,13 @@ LIB	= $(obj)lib$(CPU).o
>>>>
>>>>    START	= start.o
>>>>    COBJS	= cpu.o
>>>>
>>>> +ifdef	CONFIG_SPL_BUILD
>>>> +ifdef	CONFIG_SPL_NO_CPU_SUPPORT_CODE
>>>> +START	:=
>>>> +COBJS	:=
>>>> +endif
>>>> +endif
>>>> +
>>>>
>>>>    SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
>>>>    OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
>>>>    START	:= $(addprefix $(obj),$(START))
>>>
>>> Hi Albert,
>>>
>>> can we get this applied please?
>>
>> I still don't understand what this is supposed to do -- why not linking
>> this code is required.
>>
>> Amicalement,
>
> Hi Albert,
>
> I use very different start.S in SPL. And I don't need cpu.o at all.

That I understand; but is there a /problem/ in linking cpu.o in?

> Cheers

Amicalement,
Marek Vasut Oct. 21, 2011, 10:46 p.m. UTC | #7
On Saturday, October 22, 2011 12:44:06 AM Albert ARIBAUD wrote:
> Le 22/10/2011 00:00, Marek Vasut a écrit :
> > On Friday, October 21, 2011 11:52:23 PM Albert ARIBAUD wrote:
> >> Hi Marek,
> >> 
> >> Le 21/10/2011 22:44, Marek Vasut a écrit :
> >>> On Thursday, October 06, 2011 02:13:26 AM Marek Vasut wrote:
> >>>> This allows the SPL to avoid compiling in the CPU support code.
> >>>> 
> >>>> Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
> >>>> Cc: Stefano Babic<sbabic@denx.de>
> >>>> Cc: Wolfgang Denk<wd@denx.de>
> >>>> Cc: Detlev Zundel<dzu@denx.de>
> >>>> Cc: Scott Wood<scottwood@freescale.com>
> >>>> ---
> >>>> 
> >>>>    arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
> >>>>    1 files changed, 7 insertions(+), 0 deletions(-)
> >>>> 
> >>>> diff --git a/arch/arm/cpu/arm926ejs/Makefile
> >>>> b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
> >>>> --- a/arch/arm/cpu/arm926ejs/Makefile
> >>>> +++ b/arch/arm/cpu/arm926ejs/Makefile
> >>>> @@ -28,6 +28,13 @@ LIB	= $(obj)lib$(CPU).o
> >>>> 
> >>>>    START	= start.o
> >>>>    COBJS	= cpu.o
> >>>> 
> >>>> +ifdef	CONFIG_SPL_BUILD
> >>>> +ifdef	CONFIG_SPL_NO_CPU_SUPPORT_CODE
> >>>> +START	:=
> >>>> +COBJS	:=
> >>>> +endif
> >>>> +endif
> >>>> +
> >>>> 
> >>>>    SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
> >>>>    OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
> >>>>    START	:= $(addprefix $(obj),$(START))
> >>> 
> >>> Hi Albert,
> >>> 
> >>> can we get this applied please?
> >> 
> >> I still don't understand what this is supposed to do -- why not linking
> >> this code is required.
> >> 
> >> Amicalement,
> > 
> > Hi Albert,
> > 
> > I use very different start.S in SPL. And I don't need cpu.o at all.
> 
> That I understand; but is there a /problem/ in linking cpu.o in?

I suppose it'll be optimized out at link time ?

Cheers
Albert ARIBAUD Oct. 21, 2011, 11:08 p.m. UTC | #8
Le 22/10/2011 00:46, Marek Vasut a écrit :
> On Saturday, October 22, 2011 12:44:06 AM Albert ARIBAUD wrote:
>> Le 22/10/2011 00:00, Marek Vasut a écrit :
>>> On Friday, October 21, 2011 11:52:23 PM Albert ARIBAUD wrote:
>>>> Hi Marek,
>>>>
>>>> Le 21/10/2011 22:44, Marek Vasut a écrit :
>>>>> On Thursday, October 06, 2011 02:13:26 AM Marek Vasut wrote:
>>>>>> This allows the SPL to avoid compiling in the CPU support code.
>>>>>>
>>>>>> Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
>>>>>> Cc: Stefano Babic<sbabic@denx.de>
>>>>>> Cc: Wolfgang Denk<wd@denx.de>
>>>>>> Cc: Detlev Zundel<dzu@denx.de>
>>>>>> Cc: Scott Wood<scottwood@freescale.com>
>>>>>> ---
>>>>>>
>>>>>>     arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
>>>>>>     1 files changed, 7 insertions(+), 0 deletions(-)
>>>>>>
>>>>>> diff --git a/arch/arm/cpu/arm926ejs/Makefile
>>>>>> b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
>>>>>> --- a/arch/arm/cpu/arm926ejs/Makefile
>>>>>> +++ b/arch/arm/cpu/arm926ejs/Makefile
>>>>>> @@ -28,6 +28,13 @@ LIB	= $(obj)lib$(CPU).o
>>>>>>
>>>>>>     START	= start.o
>>>>>>     COBJS	= cpu.o
>>>>>>
>>>>>> +ifdef	CONFIG_SPL_BUILD
>>>>>> +ifdef	CONFIG_SPL_NO_CPU_SUPPORT_CODE
>>>>>> +START	:=
>>>>>> +COBJS	:=
>>>>>> +endif
>>>>>> +endif
>>>>>> +
>>>>>>
>>>>>>     SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
>>>>>>     OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
>>>>>>     START	:= $(addprefix $(obj),$(START))
>>>>>
>>>>> Hi Albert,
>>>>>
>>>>> can we get this applied please?
>>>>
>>>> I still don't understand what this is supposed to do -- why not linking
>>>> this code is required.
>>>>
>>>> Amicalement,
>>>
>>> Hi Albert,
>>>
>>> I use very different start.S in SPL. And I don't need cpu.o at all.
>>
>> That I understand; but is there a /problem/ in linking cpu.o in?
>
> I suppose it'll be optimized out at link time ?

That indirectly answers my question: what you want to achieve is 
removing dead code.

Now, about your question, you can check this if you build the  board you 
intend to apply this to, and do an objdump of the generated SPL: you'll 
see if the cpu.o functions are present or not.

(my point being that if cpu.o is to disappear because its functions are 
either useless or should move elsewhere, then the interest of a patch 
making cpu.o optional is short-lived.)

> Cheers

Amicalement,
Marek Vasut Oct. 21, 2011, 11:45 p.m. UTC | #9
On Saturday, October 22, 2011 01:08:43 AM Albert ARIBAUD wrote:
> Le 22/10/2011 00:46, Marek Vasut a écrit :
> > On Saturday, October 22, 2011 12:44:06 AM Albert ARIBAUD wrote:
> >> Le 22/10/2011 00:00, Marek Vasut a écrit :
> >>> On Friday, October 21, 2011 11:52:23 PM Albert ARIBAUD wrote:
> >>>> Hi Marek,
> >>>> 
> >>>> Le 21/10/2011 22:44, Marek Vasut a écrit :
> >>>>> On Thursday, October 06, 2011 02:13:26 AM Marek Vasut wrote:
> >>>>>> This allows the SPL to avoid compiling in the CPU support code.
> >>>>>> 
> >>>>>> Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
> >>>>>> Cc: Stefano Babic<sbabic@denx.de>
> >>>>>> Cc: Wolfgang Denk<wd@denx.de>
> >>>>>> Cc: Detlev Zundel<dzu@denx.de>
> >>>>>> Cc: Scott Wood<scottwood@freescale.com>
> >>>>>> ---
> >>>>>> 
> >>>>>>     arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
> >>>>>>     1 files changed, 7 insertions(+), 0 deletions(-)
> >>>>>> 
> >>>>>> diff --git a/arch/arm/cpu/arm926ejs/Makefile
> >>>>>> b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
> >>>>>> --- a/arch/arm/cpu/arm926ejs/Makefile
> >>>>>> +++ b/arch/arm/cpu/arm926ejs/Makefile
> >>>>>> @@ -28,6 +28,13 @@ LIB	= $(obj)lib$(CPU).o
> >>>>>> 
> >>>>>>     START	= start.o
> >>>>>>     COBJS	= cpu.o
> >>>>>> 
> >>>>>> +ifdef	CONFIG_SPL_BUILD
> >>>>>> +ifdef	CONFIG_SPL_NO_CPU_SUPPORT_CODE
> >>>>>> +START	:=
> >>>>>> +COBJS	:=
> >>>>>> +endif
> >>>>>> +endif
> >>>>>> +
> >>>>>> 
> >>>>>>     SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
> >>>>>>     OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
> >>>>>>     START	:= $(addprefix $(obj),$(START))
> >>>>> 
> >>>>> Hi Albert,
> >>>>> 
> >>>>> can we get this applied please?
> >>>> 
> >>>> I still don't understand what this is supposed to do -- why not
> >>>> linking this code is required.
> >>>> 
> >>>> Amicalement,
> >>> 
> >>> Hi Albert,
> >>> 
> >>> I use very different start.S in SPL. And I don't need cpu.o at all.
> >> 
> >> That I understand; but is there a /problem/ in linking cpu.o in?
> > 
> > I suppose it'll be optimized out at link time ?
> 
> That indirectly answers my question: what you want to achieve is
> removing dead code.

The code IS USED in U-Boot, but IS NOT USED in SPL !

> 
> Now, about your question, you can check this if you build the  board you
> intend to apply this to, and do an objdump of the generated SPL: you'll
> see if the cpu.o functions are present or not.
> 
> (my point being that if cpu.o is to disappear because its functions are
> either useless or should move elsewhere, then the interest of a patch
> making cpu.o optional is short-lived.)

I just prodded Hong about his cache patches.
> 
> > Cheers
> 
> Amicalement,
Tom Rini Oct. 22, 2011, 12:04 a.m. UTC | #10
On Fri, Oct 21, 2011 at 4:45 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> On Saturday, October 22, 2011 01:08:43 AM Albert ARIBAUD wrote:
>> Le 22/10/2011 00:46, Marek Vasut a écrit :
>> > On Saturday, October 22, 2011 12:44:06 AM Albert ARIBAUD wrote:
>> >> Le 22/10/2011 00:00, Marek Vasut a écrit :
>> >>> On Friday, October 21, 2011 11:52:23 PM Albert ARIBAUD wrote:
>> >>>> Hi Marek,
>> >>>>
>> >>>> Le 21/10/2011 22:44, Marek Vasut a écrit :
>> >>>>> On Thursday, October 06, 2011 02:13:26 AM Marek Vasut wrote:
>> >>>>>> This allows the SPL to avoid compiling in the CPU support code.
>> >>>>>>
>> >>>>>> Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
>> >>>>>> Cc: Stefano Babic<sbabic@denx.de>
>> >>>>>> Cc: Wolfgang Denk<wd@denx.de>
>> >>>>>> Cc: Detlev Zundel<dzu@denx.de>
>> >>>>>> Cc: Scott Wood<scottwood@freescale.com>
>> >>>>>> ---
>> >>>>>>
>> >>>>>>     arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
>> >>>>>>     1 files changed, 7 insertions(+), 0 deletions(-)
>> >>>>>>
>> >>>>>> diff --git a/arch/arm/cpu/arm926ejs/Makefile
>> >>>>>> b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
>> >>>>>> --- a/arch/arm/cpu/arm926ejs/Makefile
>> >>>>>> +++ b/arch/arm/cpu/arm926ejs/Makefile
>> >>>>>> @@ -28,6 +28,13 @@ LIB = $(obj)lib$(CPU).o
>> >>>>>>
>> >>>>>>     START      = start.o
>> >>>>>>     COBJS      = cpu.o
>> >>>>>>
>> >>>>>> +ifdef CONFIG_SPL_BUILD
>> >>>>>> +ifdef CONFIG_SPL_NO_CPU_SUPPORT_CODE
>> >>>>>> +START :=
>> >>>>>> +COBJS :=
>> >>>>>> +endif
>> >>>>>> +endif
>> >>>>>> +
>> >>>>>>
>> >>>>>>     SRCS       := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
>> >>>>>>     OBJS       := $(addprefix $(obj),$(COBJS) $(SOBJS))
>> >>>>>>     START      := $(addprefix $(obj),$(START))
>> >>>>>
>> >>>>> Hi Albert,
>> >>>>>
>> >>>>> can we get this applied please?
>> >>>>
>> >>>> I still don't understand what this is supposed to do -- why not
>> >>>> linking this code is required.
>> >>>>
>> >>>> Amicalement,
>> >>>
>> >>> Hi Albert,
>> >>>
>> >>> I use very different start.S in SPL. And I don't need cpu.o at all.
>> >>
>> >> That I understand; but is there a /problem/ in linking cpu.o in?
>> >
>> > I suppose it'll be optimized out at link time ?
>>
>> That indirectly answers my question: what you want to achieve is
>> removing dead code.
>
> The code IS USED in U-Boot, but IS NOT USED in SPL !

Right, but linked and unused code in SPL is (or should be!) thrown
away, is what's
trying to be driven home right now.  If the file is going to go away,
and it's compiled
thrown away at final link of SPL, lets just ignore that it exists for
a little longer, and
then it won't.
Marek Vasut Oct. 22, 2011, 12:19 a.m. UTC | #11
On Saturday, October 22, 2011 02:04:52 AM Tom Rini wrote:
> On Fri, Oct 21, 2011 at 4:45 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> > On Saturday, October 22, 2011 01:08:43 AM Albert ARIBAUD wrote:
> >> Le 22/10/2011 00:46, Marek Vasut a écrit :
> >> > On Saturday, October 22, 2011 12:44:06 AM Albert ARIBAUD wrote:
> >> >> Le 22/10/2011 00:00, Marek Vasut a écrit :
> >> >>> On Friday, October 21, 2011 11:52:23 PM Albert ARIBAUD wrote:
> >> >>>> Hi Marek,
> >> >>>> 
> >> >>>> Le 21/10/2011 22:44, Marek Vasut a écrit :
> >> >>>>> On Thursday, October 06, 2011 02:13:26 AM Marek Vasut wrote:
> >> >>>>>> This allows the SPL to avoid compiling in the CPU support code.
> >> >>>>>> 
> >> >>>>>> Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
> >> >>>>>> Cc: Stefano Babic<sbabic@denx.de>
> >> >>>>>> Cc: Wolfgang Denk<wd@denx.de>
> >> >>>>>> Cc: Detlev Zundel<dzu@denx.de>
> >> >>>>>> Cc: Scott Wood<scottwood@freescale.com>
> >> >>>>>> ---
> >> >>>>>> 
> >> >>>>>>     arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
> >> >>>>>>     1 files changed, 7 insertions(+), 0 deletions(-)
> >> >>>>>> 
> >> >>>>>> diff --git a/arch/arm/cpu/arm926ejs/Makefile
> >> >>>>>> b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
> >> >>>>>> --- a/arch/arm/cpu/arm926ejs/Makefile
> >> >>>>>> +++ b/arch/arm/cpu/arm926ejs/Makefile
> >> >>>>>> @@ -28,6 +28,13 @@ LIB = $(obj)lib$(CPU).o
> >> >>>>>> 
> >> >>>>>>     START      = start.o
> >> >>>>>>     COBJS      = cpu.o
> >> >>>>>> 
> >> >>>>>> +ifdef CONFIG_SPL_BUILD
> >> >>>>>> +ifdef CONFIG_SPL_NO_CPU_SUPPORT_CODE
> >> >>>>>> +START :=
> >> >>>>>> +COBJS :=
> >> >>>>>> +endif
> >> >>>>>> +endif
> >> >>>>>> +
> >> >>>>>> 
> >> >>>>>>     SRCS       := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
> >> >>>>>>     OBJS       := $(addprefix $(obj),$(COBJS) $(SOBJS))
> >> >>>>>>     START      := $(addprefix $(obj),$(START))
> >> >>>>> 
> >> >>>>> Hi Albert,
> >> >>>>> 
> >> >>>>> can we get this applied please?
> >> >>>> 
> >> >>>> I still don't understand what this is supposed to do -- why not
> >> >>>> linking this code is required.
> >> >>>> 
> >> >>>> Amicalement,
> >> >>> 
> >> >>> Hi Albert,
> >> >>> 
> >> >>> I use very different start.S in SPL. And I don't need cpu.o at all.
> >> >> 
> >> >> That I understand; but is there a /problem/ in linking cpu.o in?
> >> > 
> >> > I suppose it'll be optimized out at link time ?
> >> 
> >> That indirectly answers my question: what you want to achieve is
> >> removing dead code.
> > 
> > The code IS USED in U-Boot, but IS NOT USED in SPL !
> 
> Right, but linked and unused code in SPL is (or should be!) thrown
> away, is what's
> trying to be driven home right now.  If the file is going to go away,
> and it's compiled
> thrown away at final link of SPL, lets just ignore that it exists for
> a little longer, and
> then it won't.

My distrust towards compiler abilities to optimize such stuff out tells me it's 
better to avoid it even to be compiled in at all.
Albert ARIBAUD Oct. 22, 2011, 12:41 a.m. UTC | #12
Le 22/10/2011 02:19, Marek Vasut a écrit :
> On Saturday, October 22, 2011 02:04:52 AM Tom Rini wrote:
>> On Fri, Oct 21, 2011 at 4:45 PM, Marek Vasut<marek.vasut@gmail.com>  wrote:
>>> On Saturday, October 22, 2011 01:08:43 AM Albert ARIBAUD wrote:
>>>> Le 22/10/2011 00:46, Marek Vasut a écrit :
>>>>> On Saturday, October 22, 2011 12:44:06 AM Albert ARIBAUD wrote:
>>>>>> Le 22/10/2011 00:00, Marek Vasut a écrit :
>>>>>>> On Friday, October 21, 2011 11:52:23 PM Albert ARIBAUD wrote:
>>>>>>>> Hi Marek,
>>>>>>>>
>>>>>>>> Le 21/10/2011 22:44, Marek Vasut a écrit :
>>>>>>>>> On Thursday, October 06, 2011 02:13:26 AM Marek Vasut wrote:
>>>>>>>>>> This allows the SPL to avoid compiling in the CPU support code.
>>>>>>>>>>
>>>>>>>>>> Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
>>>>>>>>>> Cc: Stefano Babic<sbabic@denx.de>
>>>>>>>>>> Cc: Wolfgang Denk<wd@denx.de>
>>>>>>>>>> Cc: Detlev Zundel<dzu@denx.de>
>>>>>>>>>> Cc: Scott Wood<scottwood@freescale.com>
>>>>>>>>>> ---
>>>>>>>>>>
>>>>>>>>>>      arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
>>>>>>>>>>      1 files changed, 7 insertions(+), 0 deletions(-)
>>>>>>>>>>
>>>>>>>>>> diff --git a/arch/arm/cpu/arm926ejs/Makefile
>>>>>>>>>> b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
>>>>>>>>>> --- a/arch/arm/cpu/arm926ejs/Makefile
>>>>>>>>>> +++ b/arch/arm/cpu/arm926ejs/Makefile
>>>>>>>>>> @@ -28,6 +28,13 @@ LIB = $(obj)lib$(CPU).o
>>>>>>>>>>
>>>>>>>>>>      START      = start.o
>>>>>>>>>>      COBJS      = cpu.o
>>>>>>>>>>
>>>>>>>>>> +ifdef CONFIG_SPL_BUILD
>>>>>>>>>> +ifdef CONFIG_SPL_NO_CPU_SUPPORT_CODE
>>>>>>>>>> +START :=
>>>>>>>>>> +COBJS :=
>>>>>>>>>> +endif
>>>>>>>>>> +endif
>>>>>>>>>> +
>>>>>>>>>>
>>>>>>>>>>      SRCS       := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
>>>>>>>>>>      OBJS       := $(addprefix $(obj),$(COBJS) $(SOBJS))
>>>>>>>>>>      START      := $(addprefix $(obj),$(START))
>>>>>>>>>
>>>>>>>>> Hi Albert,
>>>>>>>>>
>>>>>>>>> can we get this applied please?
>>>>>>>>
>>>>>>>> I still don't understand what this is supposed to do -- why not
>>>>>>>> linking this code is required.
>>>>>>>>
>>>>>>>> Amicalement,
>>>>>>>
>>>>>>> Hi Albert,
>>>>>>>
>>>>>>> I use very different start.S in SPL. And I don't need cpu.o at all.
>>>>>>
>>>>>> That I understand; but is there a /problem/ in linking cpu.o in?
>>>>>
>>>>> I suppose it'll be optimized out at link time ?
>>>>
>>>> That indirectly answers my question: what you want to achieve is
>>>> removing dead code.
>>>
>>> The code IS USED in U-Boot, but IS NOT USED in SPL !
>>
>> Right, but linked and unused code in SPL is (or should be!) thrown
>> away, is what's
>> trying to be driven home right now.  If the file is going to go away,
>> and it's compiled
>> thrown away at final link of SPL, lets just ignore that it exists for
>> a little longer, and
>> then it won't.
>
> My distrust towards compiler abilities to optimize such stuff out tells me it's
> better to avoid it even to be compiled in at all.

Optimizing unused functions is a rather simple and reliable ability in 
tolchains. The issue is not really whether the toolchain is able to do 
the removal (it is); rather, the issue is whether the linker command 
line will cause the removal (it will IMO as long as -gc-sections is 
specified).

Amicalement,
Marek Vasut Oct. 22, 2011, 1:20 a.m. UTC | #13
On Saturday, October 22, 2011 02:41:54 AM Albert ARIBAUD wrote:
> Le 22/10/2011 02:19, Marek Vasut a écrit :
> > On Saturday, October 22, 2011 02:04:52 AM Tom Rini wrote:
> >> On Fri, Oct 21, 2011 at 4:45 PM, Marek Vasut<marek.vasut@gmail.com>  wrote:
> >>> On Saturday, October 22, 2011 01:08:43 AM Albert ARIBAUD wrote:
> >>>> Le 22/10/2011 00:46, Marek Vasut a écrit :
> >>>>> On Saturday, October 22, 2011 12:44:06 AM Albert ARIBAUD wrote:
> >>>>>> Le 22/10/2011 00:00, Marek Vasut a écrit :
> >>>>>>> On Friday, October 21, 2011 11:52:23 PM Albert ARIBAUD wrote:
> >>>>>>>> Hi Marek,
> >>>>>>>> 
> >>>>>>>> Le 21/10/2011 22:44, Marek Vasut a écrit :
> >>>>>>>>> On Thursday, October 06, 2011 02:13:26 AM Marek Vasut wrote:
> >>>>>>>>>> This allows the SPL to avoid compiling in the CPU support code.
> >>>>>>>>>> 
> >>>>>>>>>> Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
> >>>>>>>>>> Cc: Stefano Babic<sbabic@denx.de>
> >>>>>>>>>> Cc: Wolfgang Denk<wd@denx.de>
> >>>>>>>>>> Cc: Detlev Zundel<dzu@denx.de>
> >>>>>>>>>> Cc: Scott Wood<scottwood@freescale.com>
> >>>>>>>>>> ---
> >>>>>>>>>> 
> >>>>>>>>>>      arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
> >>>>>>>>>>      1 files changed, 7 insertions(+), 0 deletions(-)
> >>>>>>>>>> 
> >>>>>>>>>> diff --git a/arch/arm/cpu/arm926ejs/Makefile
> >>>>>>>>>> b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
> >>>>>>>>>> --- a/arch/arm/cpu/arm926ejs/Makefile
> >>>>>>>>>> +++ b/arch/arm/cpu/arm926ejs/Makefile
> >>>>>>>>>> @@ -28,6 +28,13 @@ LIB = $(obj)lib$(CPU).o
> >>>>>>>>>> 
> >>>>>>>>>>      START      = start.o
> >>>>>>>>>>      COBJS      = cpu.o
> >>>>>>>>>> 
> >>>>>>>>>> +ifdef CONFIG_SPL_BUILD
> >>>>>>>>>> +ifdef CONFIG_SPL_NO_CPU_SUPPORT_CODE
> >>>>>>>>>> +START :=
> >>>>>>>>>> +COBJS :=
> >>>>>>>>>> +endif
> >>>>>>>>>> +endif
> >>>>>>>>>> +
> >>>>>>>>>> 
> >>>>>>>>>>      SRCS       := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
> >>>>>>>>>>      OBJS       := $(addprefix $(obj),$(COBJS) $(SOBJS))
> >>>>>>>>>>      START      := $(addprefix $(obj),$(START))
> >>>>>>>>> 
> >>>>>>>>> Hi Albert,
> >>>>>>>>> 
> >>>>>>>>> can we get this applied please?
> >>>>>>>> 
> >>>>>>>> I still don't understand what this is supposed to do -- why not
> >>>>>>>> linking this code is required.
> >>>>>>>> 
> >>>>>>>> Amicalement,
> >>>>>>> 
> >>>>>>> Hi Albert,
> >>>>>>> 
> >>>>>>> I use very different start.S in SPL. And I don't need cpu.o at all.
> >>>>>> 
> >>>>>> That I understand; but is there a /problem/ in linking cpu.o in?
> >>>>> 
> >>>>> I suppose it'll be optimized out at link time ?
> >>>> 
> >>>> That indirectly answers my question: what you want to achieve is
> >>>> removing dead code.
> >>> 
> >>> The code IS USED in U-Boot, but IS NOT USED in SPL !
> >> 
> >> Right, but linked and unused code in SPL is (or should be!) thrown
> >> away, is what's
> >> trying to be driven home right now.  If the file is going to go away,
> >> and it's compiled
> >> thrown away at final link of SPL, lets just ignore that it exists for
> >> a little longer, and
> >> then it won't.
> > 
> > My distrust towards compiler abilities to optimize such stuff out tells
> > me it's better to avoid it even to be compiled in at all.
> 
> Optimizing unused functions is a rather simple and reliable ability in
> tolchains. The issue is not really whether the toolchain is able to do
> the removal (it is); rather, the issue is whether the linker command
> line will cause the removal (it will IMO as long as -gc-sections is
> specified).
> 
> Amicalement,

So what you suggest is to leave cpu.o compiling and drop only start.S ?

Cheers
Albert ARIBAUD Oct. 22, 2011, 7:05 a.m. UTC | #14
Le 22/10/2011 03:20, Marek Vasut a écrit :
> On Saturday, October 22, 2011 02:41:54 AM Albert ARIBAUD wrote:
>> Le 22/10/2011 02:19, Marek Vasut a écrit :
>>> On Saturday, October 22, 2011 02:04:52 AM Tom Rini wrote:
>>>> On Fri, Oct 21, 2011 at 4:45 PM, Marek Vasut<marek.vasut@gmail.com>   wrote:
>>>>> On Saturday, October 22, 2011 01:08:43 AM Albert ARIBAUD wrote:
>>>>>> Le 22/10/2011 00:46, Marek Vasut a écrit :
>>>>>>> On Saturday, October 22, 2011 12:44:06 AM Albert ARIBAUD wrote:
>>>>>>>> Le 22/10/2011 00:00, Marek Vasut a écrit :
>>>>>>>>> On Friday, October 21, 2011 11:52:23 PM Albert ARIBAUD wrote:
>>>>>>>>>> Hi Marek,
>>>>>>>>>>
>>>>>>>>>> Le 21/10/2011 22:44, Marek Vasut a écrit :
>>>>>>>>>>> On Thursday, October 06, 2011 02:13:26 AM Marek Vasut wrote:
>>>>>>>>>>>> This allows the SPL to avoid compiling in the CPU support code.
>>>>>>>>>>>>
>>>>>>>>>>>> Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
>>>>>>>>>>>> Cc: Stefano Babic<sbabic@denx.de>
>>>>>>>>>>>> Cc: Wolfgang Denk<wd@denx.de>
>>>>>>>>>>>> Cc: Detlev Zundel<dzu@denx.de>
>>>>>>>>>>>> Cc: Scott Wood<scottwood@freescale.com>
>>>>>>>>>>>> ---
>>>>>>>>>>>>
>>>>>>>>>>>>       arch/arm/cpu/arm926ejs/Makefile |    7 +++++++
>>>>>>>>>>>>       1 files changed, 7 insertions(+), 0 deletions(-)
>>>>>>>>>>>>
>>>>>>>>>>>> diff --git a/arch/arm/cpu/arm926ejs/Makefile
>>>>>>>>>>>> b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
>>>>>>>>>>>> --- a/arch/arm/cpu/arm926ejs/Makefile
>>>>>>>>>>>> +++ b/arch/arm/cpu/arm926ejs/Makefile
>>>>>>>>>>>> @@ -28,6 +28,13 @@ LIB = $(obj)lib$(CPU).o
>>>>>>>>>>>>
>>>>>>>>>>>>       START      = start.o
>>>>>>>>>>>>       COBJS      = cpu.o
>>>>>>>>>>>>
>>>>>>>>>>>> +ifdef CONFIG_SPL_BUILD
>>>>>>>>>>>> +ifdef CONFIG_SPL_NO_CPU_SUPPORT_CODE
>>>>>>>>>>>> +START :=
>>>>>>>>>>>> +COBJS :=
>>>>>>>>>>>> +endif
>>>>>>>>>>>> +endif
>>>>>>>>>>>> +
>>>>>>>>>>>>
>>>>>>>>>>>>       SRCS       := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
>>>>>>>>>>>>       OBJS       := $(addprefix $(obj),$(COBJS) $(SOBJS))
>>>>>>>>>>>>       START      := $(addprefix $(obj),$(START))
>>>>>>>>>>>
>>>>>>>>>>> Hi Albert,
>>>>>>>>>>>
>>>>>>>>>>> can we get this applied please?
>>>>>>>>>>
>>>>>>>>>> I still don't understand what this is supposed to do -- why not
>>>>>>>>>> linking this code is required.
>>>>>>>>>>
>>>>>>>>>> Amicalement,
>>>>>>>>>
>>>>>>>>> Hi Albert,
>>>>>>>>>
>>>>>>>>> I use very different start.S in SPL. And I don't need cpu.o at all.
>>>>>>>>
>>>>>>>> That I understand; but is there a /problem/ in linking cpu.o in?
>>>>>>>
>>>>>>> I suppose it'll be optimized out at link time ?
>>>>>>
>>>>>> That indirectly answers my question: what you want to achieve is
>>>>>> removing dead code.
>>>>>
>>>>> The code IS USED in U-Boot, but IS NOT USED in SPL !
>>>>
>>>> Right, but linked and unused code in SPL is (or should be!) thrown
>>>> away, is what's
>>>> trying to be driven home right now.  If the file is going to go away,
>>>> and it's compiled
>>>> thrown away at final link of SPL, lets just ignore that it exists for
>>>> a little longer, and
>>>> then it won't.
>>>
>>> My distrust towards compiler abilities to optimize such stuff out tells
>>> me it's better to avoid it even to be compiled in at all.
>>
>> Optimizing unused functions is a rather simple and reliable ability in
>> tolchains. The issue is not really whether the toolchain is able to do
>> the removal (it is); rather, the issue is whether the linker command
>> line will cause the removal (it will IMO as long as -gc-sections is
>> specified).
>>
>> Amicalement,
>
> So what you suggest is to leave cpu.o compiling and drop only start.S ?

Yes -- once you're sure that -gc-sections is there.

> Cheers

Amicalement,
diff mbox

Patch

diff --git a/arch/arm/cpu/arm926ejs/Makefile b/arch/arm/cpu/arm926ejs/Makefile
index 930e0d1..3f9b0f1 100644
--- a/arch/arm/cpu/arm926ejs/Makefile
+++ b/arch/arm/cpu/arm926ejs/Makefile
@@ -28,6 +28,13 @@  LIB	= $(obj)lib$(CPU).o
 START	= start.o
 COBJS	= cpu.o
 
+ifdef	CONFIG_SPL_BUILD
+ifdef	CONFIG_SPL_NO_CPU_SUPPORT_CODE
+START	:=
+COBJS	:=
+endif
+endif
+
 SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
 START	:= $(addprefix $(obj),$(START))