Skip to contentSkip to conversation

Don't inline weak symbols

PATCH New Ron 3 participants 8 messages Aug 5, 2009 – Oct 3, 2009

lore
Share & tools
lore

Ron

author
#0 lore raw

PATCH 1/1 Don't inline weak symbols

GCC 4.4 complains about this now.

---
 lib_arm/board.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
lib_arm/board.c +9 -9
index a44d308..02a55eb 100644
@@ -124,23 +124,23 @@ void *sbrk (ptrdiff_t increment)
  * May be supplied by boards if desired
  */
 void inline __coloured_LED_init (void) {}
-void inline coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init")));
+void coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init")));
 void inline __red_LED_on (void) {}
-void inline red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
+void red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
 void inline __red_LED_off(void) {}
-void inline red_LED_off(void)	     __attribute__((weak, alias("__red_LED_off")));
+void red_LED_off(void) __attribute__((weak, alias("__red_LED_off")));
 void inline __green_LED_on(void) {}
-void inline green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
+void green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
 void inline __green_LED_off(void) {}
-void inline green_LED_off(void)__attribute__((weak, alias("__green_LED_off")));
+void green_LED_off(void) __attribute__((weak, alias("__green_LED_off")));
 void inline __yellow_LED_on(void) {}
-void inline yellow_LED_on(void)__attribute__((weak, alias("__yellow_LED_on")));
+void yellow_LED_on(void) __attribute__((weak, alias("__yellow_LED_on")));
 void inline __yellow_LED_off(void) {}
-void inline yellow_LED_off(void)__attribute__((weak, alias("__yellow_LED_off")));
+void yellow_LED_off(void) __attribute__((weak, alias("__yellow_LED_off")));
 void inline __blue_LED_on(void) {}
-void inline blue_LED_on(void)__attribute__((weak, alias("__blue_LED_on")));
+void blue_LED_on(void) __attribute__((weak, alias("__blue_LED_on")));
 void inline __blue_LED_off(void) {}
-void inline blue_LED_off(void)__attribute__((weak, alias("__blue_LED_off")));
+void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));
 
 /************************************************************************
  * Init Utilities							*
Signature · 1 line
1.6.3.3
author
#2 lore raw

PATCH 1/1 Don't inline weak symbols

Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 2 lines · Ron

GCC 4.4 complains about this now.

I'd remove the inline ot all

The compiler likely will already inline/eradicate the defaults there, since the empty definition is visible to it, so yes, that would be valid too, and might make that block a bit easier on the eyes :)

Cheers,
Ron

#3 lore raw

PATCH v2 1/1 Don't inline weak symbols

In reply to Ron

From: Ron Lee <[email protected]>

use the same dummy weak functions too
it will save 200 bytes

update the implementation

---
 lib_arm/board.c |   28 ++++++++++------------------
 1 files changed, 10 insertions(+), 18 deletions(-)
lib_arm/board.c +10 -18
index a44d308..37e4cc9 100644
@@ -123,24 +123,16 @@ void *sbrk (ptrdiff_t increment)
  ************************************************************************
  * May be supplied by boards if desired
  */
-void inline __coloured_LED_init (void) {}
-void inline coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init")));
-void inline __red_LED_on (void) {}
-void inline red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
-void inline __red_LED_off(void) {}
-void inline red_LED_off(void)	     __attribute__((weak, alias("__red_LED_off")));
-void inline __green_LED_on(void) {}
-void inline green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
-void inline __green_LED_off(void) {}
-void inline green_LED_off(void)__attribute__((weak, alias("__green_LED_off")));
-void inline __yellow_LED_on(void) {}
-void inline yellow_LED_on(void)__attribute__((weak, alias("__yellow_LED_on")));
-void inline __yellow_LED_off(void) {}
-void inline yellow_LED_off(void)__attribute__((weak, alias("__yellow_LED_off")));
-void inline __blue_LED_on(void) {}
-void inline blue_LED_on(void)__attribute__((weak, alias("__blue_LED_on")));
-void inline __blue_LED_off(void) {}
-void inline blue_LED_off(void)__attribute__((weak, alias("__blue_LED_off")));
+void __coloured_dummy(void) {}
+void coloured_LED_init(void)	__attribute__((weak, alias("__coloured_dummy")));
+void red_LED_on(void)		__attribute__((weak, alias("__coloured_dummy")));
+void red_LED_off(void)		__attribute__((weak, alias("__coloured_dummy")));
+void green_LED_on(void)		__attribute__((weak, alias("__coloured_dummy")));
+void green_LED_off(void)	__attribute__((weak, alias("__coloured_dummy")));
+void yellow_LED_on(void)	__attribute__((weak, alias("__coloured_dummy")));
+void yellow_LED_off(void)	__attribute__((weak, alias("__coloured_dummy")));
+void blue_LED_on(void)		__attribute__((weak, alias("__coloured_dummy")));
+void blue_LED_off(void)		__attribute__((weak, alias("__coloured_dummy")));
 
 /************************************************************************
  * Init Utilities							*
Signature · 1 line
1.6.3.1
#4 lore raw

PATCH v2 1/1 Don't inline weak symbols

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 5 lines · In message <[email protected]> you wrote:

From: Ron Lee <[email protected]>

use the same dummy weak functions too
it will save 200 bytes

Quoted 7 lines

update the implementation

---
 lib_arm/board.c |   28 ++++++++++------------------
 1 files changed, 10 insertions(+), 18 deletions(-)

This whole stuff should be #ifdef'ed and only included when some board actually uses such a feature.

Best regards,

Wolfgang Denk

Signature · 7 lines
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
"One day," said a dull voice from down below, "I'm going to  be  back
in  form again and you're going to be very sorry you said that. For a
very long time. I might even go so far as to make even more Time just
for you to be sorry in."              - Terry Pratchett, _Small Gods_
#5 lore raw

PATCH v2 1/1 Don't inline weak symbols

Quoted 10 lines · Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 7 lines · In message <[email protected]> you wrote:

From: Ron Lee <[email protected]>

use the same dummy weak functions too
it will save 200 bytes

Quoted 8 lines
Quoted 5 lines

update the implementation

---
 lib_arm/board.c |   28 ++++++++++------------------
 1 files changed, 10 insertions(+), 18 deletions(-)

This whole stuff should be #ifdef'ed and only included when some board actually uses such a feature.

the current patch is a fix for gcc 4.4

such update could be done later as we need to touch a lot's of file c and assembly

Best Regards,
J.

#6 lore raw

PATCH v2 1/1 Don't inline weak symbols

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 6 lines
Quoted 5 lines
---
 lib_arm/board.c |   28 ++++++++++------------------
 1 files changed, 10 insertions(+), 18 deletions(-)
Quoted 6 lines
Quoted 2 lines

This whole stuff should be #ifdef'ed and only included when some board actually uses such a feature.

the current patch is a fix for gcc 4.4

such update could be done later as we need to touch a lot's of file c and assembly

We could also do the change to lib_arm/board.c right now. This should not affect any other boards or files.

Best regards,

Wolfgang Denk

Signature · 6 lines
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
"The more data I punch in this card,  the lighter it becomes, and the
lower the mailing cost."
                     - Stan Kelly-Bootle, "The Devil's DP Dictionary"
#7 lore raw

PATCH 1/1 Don't inline weak symbols

In reply to Ron

Dear Tom,

Quoted 36 lines · In message <[email protected]> Ron Lee wrote:

GCC 4.4 complains about this now.

---
 lib_arm/board.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
lib_arm/board.c +6 -7
index a44d308..02a55eb 100644
@@ -124,23 +124,23 @@ void *sbrk (ptrdiff_t increment)
  * May be supplied by boards if desired
  */
 void inline __coloured_LED_init (void) {}
-void inline coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init")));
+void coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init")));
 void inline __red_LED_on (void) {}
-void inline red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
+void red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
 void inline __red_LED_off(void) {}
-void inline red_LED_off(void)	     __attribute__((weak, alias("__red_LED_off")));
+void red_LED_off(void) __attribute__((weak, alias("__red_LED_off")));
 void inline __green_LED_on(void) {}
-void inline green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
+void green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
 void inline __green_LED_off(void) {}
-void inline green_LED_off(void)__attribute__((weak, alias("__green_LED_off")));
+void green_LED_off(void) __attribute__((weak, alias("__green_LED_off")));
 void inline __yellow_LED_on(void) {}
-void inline yellow_LED_on(void)__attribute__((weak, alias("__yellow_LED_on")));
+void yellow_LED_on(void) __attribute__((weak, alias("__yellow_LED_on")));
 void inline __yellow_LED_off(void) {}
-void inline yellow_LED_off(void)__attribute__((weak, alias("__yellow_LED_off")));

lib_arm/board.c void *sbrk (ptrdiff_t increment) · line 146

Quoted 10 lines
lib_arm/board.c +3 -2
+void yellow_LED_off(void) __attribute__((weak, alias("__yellow_LED_off")));
 void inline __blue_LED_on(void) {}
-void inline blue_LED_on(void)__attribute__((weak, alias("__blue_LED_on")));
+void blue_LED_on(void) __attribute__((weak, alias("__blue_LED_on")));
 void inline __blue_LED_off(void) {}
-void inline blue_LED_off(void)__attribute__((weak, alias("__blue_LED_off")));
+void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));
 
 /************************************************************************
  * Init Utilities							*

Do you have this patch on your list?

Best regards,

Wolfgang Denk

Signature · 5 lines
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
Humans do claim a great deal for that particular emotion (love).
	-- Spock, "The Lights of Zetar", stardate 5725.6