Patchwork [U-Boot,12/13] add support for function-sections

login
register
mail settings
Submitter Michael Schwingen
Date Dec. 28, 2010, 12:43 p.m.
Message ID <1293540211-3684-13-git-send-email-michael@schwingen.org>
Download mbox | patch
Permalink /patch/76832/
State Rejected
Headers show

Comments

Michael Schwingen - Dec. 28, 2010, 12:43 p.m.
Signed-off-by: Michael Schwingen <michael@schwingen.org>
---
 config.mk                |    6 ++++++
 include/configs/actux1.h |    1 +
 include/configs/actux2.h |    1 +
 include/configs/actux3.h |    1 +
 include/configs/actux4.h |    1 +
 5 files changed, 10 insertions(+), 0 deletions(-)
Mike Frysinger - Dec. 29, 2010, 4:47 a.m.
On Tuesday, December 28, 2010 07:43:30 Michael Schwingen wrote:
> Signed-off-by: Michael Schwingen <michael@schwingen.org>
> ---
>  config.mk                |    6 ++++++
>  include/configs/actux1.h |    1 +
>  include/configs/actux2.h |    1 +
>  include/configs/actux3.h |    1 +
>  include/configs/actux4.h |    1 +
>  5 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/config.mk b/config.mk
> index 66f8fe6..f7c7760 100644
> --- a/config.mk
> +++ b/config.mk
> @@ -152,6 +152,9 @@ endif
>  RELFLAGS= $(PLATFORM_RELFLAGS)
>  DBGFLAGS= -g # -DDEBUG
>  OPTFLAGS= -Os #-fomit-frame-pointer
> +ifeq ($(CONFIG_USE_FUNCTION_SECTIONS),y)
> +OPTFLAGS += -ffunction-sections
> +endif

you can already do this with board config.mk and PLATFORM_RELFLAGS.  no need 
to introduce some random new config name for a random compiler flag.
-mike
Michael Schwingen - Dec. 29, 2010, 8:28 a.m.
Am 12/29/2010 05:47 AM, schrieb Mike Frysinger:
> On Tuesday, December 28, 2010 07:43:30 Michael Schwingen wrote:
>> Signed-off-by: Michael Schwingen <michael@schwingen.org>
>> ---
>>  config.mk                |    6 ++++++
>>  include/configs/actux1.h |    1 +
>>  include/configs/actux2.h |    1 +
>>  include/configs/actux3.h |    1 +
>>  include/configs/actux4.h |    1 +
>>  5 files changed, 10 insertions(+), 0 deletions(-)
>>
>> diff --git a/config.mk b/config.mk
>> index 66f8fe6..f7c7760 100644
>> --- a/config.mk
>> +++ b/config.mk
>> @@ -152,6 +152,9 @@ endif
>>  RELFLAGS= $(PLATFORM_RELFLAGS)
>>  DBGFLAGS= -g # -DDEBUG
>>  OPTFLAGS= -Os #-fomit-frame-pointer
>> +ifeq ($(CONFIG_USE_FUNCTION_SECTIONS),y)
>> +OPTFLAGS += -ffunction-sections
>> +endif
> you can already do this with board config.mk and PLATFORM_RELFLAGS.  no need 
> to introduce some random new config name for a random compiler flag.
OK, I had not seen that possibility.
Setting a platform variable in a board-dependant way sounds a bit wrong,
but it works.

cu
Michael
Mike Frysinger - Dec. 29, 2010, 8:35 a.m.
On Wednesday, December 29, 2010 03:28:51 Michael Schwingen wrote:
> Am 12/29/2010 05:47 AM, schrieb Mike Frysinger:
> > On Tuesday, December 28, 2010 07:43:30 Michael Schwingen wrote:
> >> Signed-off-by: Michael Schwingen <michael@schwingen.org>
> >> ---
> >> 
> >>  config.mk                |    6 ++++++
> >>  include/configs/actux1.h |    1 +
> >>  include/configs/actux2.h |    1 +
> >>  include/configs/actux3.h |    1 +
> >>  include/configs/actux4.h |    1 +
> >>  5 files changed, 10 insertions(+), 0 deletions(-)
> >> 
> >> diff --git a/config.mk b/config.mk
> >> index 66f8fe6..f7c7760 100644
> >> --- a/config.mk
> >> +++ b/config.mk
> >> @@ -152,6 +152,9 @@ endif
> >> 
> >>  RELFLAGS= $(PLATFORM_RELFLAGS)
> >>  DBGFLAGS= -g # -DDEBUG
> >>  OPTFLAGS= -Os #-fomit-frame-pointer
> >> 
> >> +ifeq ($(CONFIG_USE_FUNCTION_SECTIONS),y)
> >> +OPTFLAGS += -ffunction-sections
> >> +endif
> > 
> > you can already do this with board config.mk and PLATFORM_RELFLAGS.  no
> > need to introduce some random new config name for a random compiler
> > flag.
> 
> OK, I had not seen that possibility.
> Setting a platform variable in a board-dependant way sounds a bit wrong,
> but it works.

you should be appending it, not setting it
-mike

Patch

diff --git a/config.mk b/config.mk
index 66f8fe6..f7c7760 100644
--- a/config.mk
+++ b/config.mk
@@ -152,6 +152,9 @@  endif
 RELFLAGS= $(PLATFORM_RELFLAGS)
 DBGFLAGS= -g # -DDEBUG
 OPTFLAGS= -Os #-fomit-frame-pointer
+ifeq ($(CONFIG_USE_FUNCTION_SECTIONS),y)
+OPTFLAGS += -ffunction-sections
+endif
 ifndef LDSCRIPT
 #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
 ifeq ($(CONFIG_NAND_U_BOOT),y)
@@ -205,6 +208,9 @@  endif
 AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
 
 LDFLAGS += -Bstatic -T $(obj)u-boot.lds $(PLATFORM_LDFLAGS)
+ifeq ($(CONFIG_USE_FUNCTION_SECTIONS),y)
+LDFLAGS += --gc-sections
+endif
 ifneq ($(CONFIG_SYS_TEXT_BASE),)
 LDFLAGS += -Ttext $(CONFIG_SYS_TEXT_BASE)
 endif
diff --git a/include/configs/actux1.h b/include/configs/actux1.h
index 2ffedf1..e4f7358 100644
--- a/include/configs/actux1.h
+++ b/include/configs/actux1.h
@@ -28,6 +28,7 @@ 
 
 #define CONFIG_IXP425			1
 #define CONFIG_ACTUX1			1
+#define CONFIG_USE_FUNCTION_SECTIONS    1
 
 #define CONFIG_DISPLAY_CPUINFO		1
 #define CONFIG_DISPLAY_BOARDINFO	1
diff --git a/include/configs/actux2.h b/include/configs/actux2.h
index 4ba3ce0..bef5bc0 100644
--- a/include/configs/actux2.h
+++ b/include/configs/actux2.h
@@ -28,6 +28,7 @@ 
 
 #define CONFIG_IXP425			1
 #define CONFIG_ACTUX2			1
+#define CONFIG_USE_FUNCTION_SECTIONS    1
 
 #define CONFIG_DISPLAY_CPUINFO		1
 #define CONFIG_DISPLAY_BOARDINFO	1
diff --git a/include/configs/actux3.h b/include/configs/actux3.h
index 4b9b496..33d2db1 100644
--- a/include/configs/actux3.h
+++ b/include/configs/actux3.h
@@ -28,6 +28,7 @@ 
 
 #define CONFIG_IXP425			1
 #define CONFIG_ACTUX3			1
+#define CONFIG_USE_FUNCTION_SECTIONS    1
 
 #define CONFIG_DISPLAY_CPUINFO		1
 #define CONFIG_DISPLAY_BOARDINFO	1
diff --git a/include/configs/actux4.h b/include/configs/actux4.h
index ac7d1ba..ed68302 100644
--- a/include/configs/actux4.h
+++ b/include/configs/actux4.h
@@ -28,6 +28,7 @@ 
 
 #define CONFIG_IXP425			1
 #define CONFIG_ACTUX4			1
+#define CONFIG_USE_FUNCTION_SECTIONS    1
 
 #define CONFIG_DISPLAY_CPUINFO		1
 #define CONFIG_DISPLAY_BOARDINFO	1