Message ID | 20101114195506.B5B7A14EA7E@gemini.denx.de |
---|---|
State | RFC |
Headers | show |
Le 14/11/2010 20:55, Wolfgang Denk a écrit : > Actually situation might be differenton ARM. I just did quick and > ditry test for the TX25 board: > > [...] > > The global pointer method saves a total of 152 bytes here > (156 in .text saved, but 4 in .data needed). > > OK, this is not even 0.1% of the size, but anyway... If the difference in size is marginal, then I prefer the implementation that has the least 'quirks' and most closely complies with EABI/AAPCS. BTW your quick'n'dirty test puts GD at a fixed location identical for code running before and after relocation, right? But do we not change the stack location? > Best regards, > > Wolfgang Denk Amicalement,
Dear Albert ARIBAUD, In message <4CE04241.7070407@free.fr> you wrote: > > > OK, this is not even 0.1% of the size, but anyway... > > If the difference in size is marginal, then I prefer the implementation > that has the least 'quirks' and most closely complies with EABI/AAPCS. Yes, I agree. On ARM the global pointermethod has both the advantage of being cleaner and giving slightly smaller code. > BTW your quick'n'dirty test puts GD at a fixed location identical for > code running before and after relocation, right? But do we not change > the stack location? Yes, we do. I just wanted to compile it for the code size difference; I did not attempt to make a perfect patch yet :-) Best regards, Wolfgang Denk
diff --git a/arch/arm/cpu/arm926ejs/config.mk b/arch/arm/cpu/arm926ejs/config.mk index f8ef90f..f8bbeba 100644 --- a/arch/arm/cpu/arm926ejs/config.mk +++ b/arch/arm/cpu/arm926ejs/config.mk @@ -21,7 +21,7 @@ # MA 02111-1307 USA # -PLATFORM_RELFLAGS += -fno-common -ffixed-r8 -msoft-float +PLATFORM_RELFLAGS += -fno-common -msoft-float PLATFORM_CPPFLAGS += -march=armv5te # ========================================================================= diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h index ada3fbb..7561523 100644 --- a/arch/arm/include/asm/global_data.h +++ b/arch/arm/include/asm/global_data.h @@ -86,6 +86,13 @@ typedef struct global_data { #define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */ #define GD_FLG_ENV_READY 0x00080 /* Environment imported into hash table */ + +#if 0 #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8") +#else /* We could use plain global data, but the resulting code is bigger */ +#define XTRN_DECLARE_GLOBAL_DATA_PTR extern +#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \ + gd_t *gd +#endif #endif /* __ASM_GBL_DATA_H */ diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 1fd5f83..b0de6c7 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -647,3 +647,14 @@ void hang (void) puts ("### ERROR ### Please RESET the board ###\n"); for (;;); } + +#if 1 /* We could use plain global data, but the resulting code is bigger */ +/* + * Pointer to initial global data area + * + * Here we initialize it. + */ +#undef XTRN_DECLARE_GLOBAL_DATA_PTR +#define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */ +DECLARE_GLOBAL_DATA_PTR = (gd_t *) (CONFIG_SYS_INIT_SP_ADDR); +#endif /* 0 */