[U-Boot] [PATCH 1/5] x86: Fix compilation on 64-bit build machines

From: Graeme Russ graeme.russ@gmail.com
Signed-off-by: Graeme Russ graeme.russ@gmail.com Signed-off-by: Simon Glass sjg@chromium.org --- Makefile | 1 + arch/x86/cpu/config.mk | 3 ++- examples/standalone/Makefile | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index 1a17be9..2ad5cc5 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,7 @@ VERSION_FILE = $(obj)include/generated/version_autogenerated.h
HOSTARCH := $(shell uname -m | \ sed -e s/i.86/x86/ \ + -e s/x86_64/x86/ \ -e s/sun4u/sparc64/ \ -e s/arm.*/arm/ \ -e s/sa110/arm/ \ diff --git a/arch/x86/cpu/config.mk b/arch/x86/cpu/config.mk index c00f867..092de68 100644 --- a/arch/x86/cpu/config.mk +++ b/arch/x86/cpu/config.mk @@ -23,7 +23,8 @@
CROSS_COMPILE ?= i386-linux-
-PLATFORM_CPPFLAGS += -DCONFIG_X86 -D__I386__ -march=i386 -Werror +PLATFORM_CPPFLAGS += -DCONFIG_X86 -D__I386__ -march=i386 -Werror -m32 +PLATFORM_LDFLAGS += -m elf_i386
# DO NOT MODIFY THE FOLLOWING UNLESS YOU REALLY KNOW WHAT YOU ARE DOING! LDPPFLAGS += -DRESET_SEG_START=0xffff0000 diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index baaa2fb..7c1ea5c 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -98,7 +98,7 @@ $(ELF): $(obj)%: $(obj)%.o $(LIB) $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \ -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \ - -L$(gcclibdir) -lgcc + -L$(USE_PRIVATE_LIBGCC) -lgcc
$(SREC): $(obj)%.srec: $(obj)%

From: Graeme Russ graeme.russ@gmail.com
So it can be used as a type in struct global_data and remove an ugly typecast
Signed-off-by: Graeme Russ graeme.russ@gmail.com Signed-off-by: Simon Glass sjg@chromium.org Acked-by: Marek Vasut marex@denx.de --- arch/x86/cpu/cpu.c | 2 +- arch/x86/include/asm/global_data.h | 4 +++- arch/x86/lib/init_helpers.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index e9bb0d7..67de6bc 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -92,7 +92,7 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries)
void init_gd(gd_t *id, u64 *gdt_addr) { - id->gd_addr = (ulong)id; + id->gd_addr = id; setup_gdt(id, gdt_addr); }
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h index bce999f..d471367 100644 --- a/arch/x86/include/asm/global_data.h +++ b/arch/x86/include/asm/global_data.h @@ -33,9 +33,11 @@
#ifndef __ASSEMBLY__
+typedef struct global_data gd_t; + typedef struct global_data { /* NOTE: gd_addr MUST be first member of struct global_data! */ - unsigned long gd_addr; /* Location of Global Data */ + gd_t *gd_addr; /* Location of Global Data */ bd_t *bd; unsigned long flags; unsigned int baudrate; diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c index 9ec34ff..2f718d7 100644 --- a/arch/x86/lib/init_helpers.c +++ b/arch/x86/lib/init_helpers.c @@ -126,7 +126,7 @@ int copy_gd_to_ram_f_r(void) * in-RAM copy of Global Data (calculate_relocation_address() * has already calculated the in-RAM location of the GDT) */ - ram_gd->gd_addr = (ulong)ram_gd; + ram_gd->gd_addr = ram_gd; init_gd(ram_gd, (u64 *)gd->gdt_addr);
return 0;

Hi Simon,
Was there a reason to repost these patches? I notice you did a couple of tweaks and added your SoB, but for something so trivial, I don't think there was a need to repost
Regards,
Graeme
On Wed, Nov 28, 2012 at 12:38 PM, Simon Glass sjg@chromium.org wrote:
From: Graeme Russ graeme.russ@gmail.com
So it can be used as a type in struct global_data and remove an ugly typecast
Signed-off-by: Graeme Russ graeme.russ@gmail.com Signed-off-by: Simon Glass sjg@chromium.org Acked-by: Marek Vasut marex@denx.de
arch/x86/cpu/cpu.c | 2 +- arch/x86/include/asm/global_data.h | 4 +++- arch/x86/lib/init_helpers.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index e9bb0d7..67de6bc 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -92,7 +92,7 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries)
void init_gd(gd_t *id, u64 *gdt_addr) {
id->gd_addr = (ulong)id;
id->gd_addr = id; setup_gdt(id, gdt_addr);
}
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h index bce999f..d471367 100644 --- a/arch/x86/include/asm/global_data.h +++ b/arch/x86/include/asm/global_data.h @@ -33,9 +33,11 @@
#ifndef __ASSEMBLY__
+typedef struct global_data gd_t;
typedef struct global_data { /* NOTE: gd_addr MUST be first member of struct global_data! */
unsigned long gd_addr; /* Location of Global Data */
gd_t *gd_addr; /* Location of Global Data */ bd_t *bd; unsigned long flags; unsigned int baudrate;
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c index 9ec34ff..2f718d7 100644 --- a/arch/x86/lib/init_helpers.c +++ b/arch/x86/lib/init_helpers.c @@ -126,7 +126,7 @@ int copy_gd_to_ram_f_r(void) * in-RAM copy of Global Data (calculate_relocation_address() * has already calculated the in-RAM location of the GDT) */
ram_gd->gd_addr = (ulong)ram_gd;
ram_gd->gd_addr = ram_gd; init_gd(ram_gd, (u64 *)gd->gdt_addr); return 0;
-- 1.7.7.3

Hi Graeme,
On Tue, Nov 27, 2012 at 5:43 PM, Graeme Russ graeme.russ@gmail.com wrote:
Hi Simon,
Was there a reason to repost these patches? I notice you did a couple of tweaks and added your SoB, but for something so trivial, I don't think there was a need to repost
I wasn't sure, so decided to err on the side of caution, since I thought it best to pull patches out of patchwork, rather than add little fixes along the way.
Regards, Simon

From: Graeme Russ graeme.russ@gmail.com
Putting global data on the stack simplifies the init process (and makes it slightly quicker). During the 'flash' stage of the init sequence, global data is in the CAR stack. After SDRAM is initialised, global data is copied from CAR to the SDRAM stack
Signed-off-by: Graeme Russ graeme.russ@gmail.com Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/cpu/cpu.c | 6 --- arch/x86/cpu/start.S | 67 +++++++++++++++++++++++++++++++---- arch/x86/include/asm/global_data.h | 1 - arch/x86/include/asm/init_helpers.h | 1 - arch/x86/include/asm/processor.h | 1 + arch/x86/lib/board.c | 2 +- arch/x86/lib/init_helpers.c | 37 +------------------- include/configs/coreboot.h | 5 +-- include/configs/eNET.h | 6 --- 9 files changed, 65 insertions(+), 61 deletions(-)
diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index 67de6bc..9c2db9f 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -90,12 +90,6 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries) asm volatile("lgdtl %0\n" : : "m" (gdt)); }
-void init_gd(gd_t *id, u64 *gdt_addr) -{ - id->gd_addr = id; - setup_gdt(id, gdt_addr); -} - void setup_gdt(gd_t *id, u64 *gdt_addr) { /* CS: code, read/execute, 4 GB, base 0 */ diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S index ee0dabe..ec12e80 100644 --- a/arch/x86/cpu/start.S +++ b/arch/x86/cpu/start.S @@ -83,13 +83,33 @@ car_init_ret: * or fully initialised SDRAM - we really don't care which) * starting at CONFIG_SYS_CAR_ADDR to be used as a temporary stack */ - movl $CONFIG_SYS_INIT_SP_ADDR, %esp
- /* Initialise the Global Data Pointer */ - movl $CONFIG_SYS_INIT_GD_ADDR, %eax - movl %eax, %edx - addl $GENERATED_GBL_DATA_SIZE, %edx - call init_gd; + /* Stack grows down from top of CAR */ + movl $(CONFIG_SYS_CAR_ADDR + CONFIG_SYS_CAR_SIZE), %esp + + /* Reserve space on stack for global data */ + subl $GENERATED_GBL_DATA_SIZE, %esp + + /* Align global data to 16-byte boundary */ + andl $0xfffffff0, %esp + + /* Setup first parameter to setup_gdt */ + movl %esp, %eax + + /* Reserve space for global descriptor table */ + subl $X86_GDT_SIZE, %esp + + /* Align temporary global descriptor table to 16-byte boundary */ + andl $0xfffffff0, %esp + + /* Set second parameter to setup_gdt */ + movl %esp, %edx + + /* gd->gd_addr = gd (Required to allow gd->xyz to work) */ + movl %eax, (%eax) + + /* Setup global descriptor table so gd->xyz works */ + call setup_gdt
/* Set parameter to board_init_f() to boot flags */ xorl %eax, %eax @@ -113,9 +133,42 @@ board_init_f_r_trampoline: * %eax = Address of top of new stack */
- /* Setup stack in RAM */ + /* Stack grows down from top of SDRAM */ movl %eax, %esp
+ /* Reserve space on stack for global data */ + subl $GENERATED_GBL_DATA_SIZE, %esp + + /* Align global data to 16-byte boundary */ + andl $0xfffffff0, %esp + + /* Setup first parameter to memcpy (and setup_gdt) */ + movl %esp, %eax + + /* Setup second parameter to memcpy */ + fs movl 0, %edx + + /* Set third parameter to memcpy */ + movl $GENERATED_GBL_DATA_SIZE, %ecx + + /* Copy global data from CAR to SDRAM stack */ + call memcpy + + /* Reserve space for global descriptor table */ + subl $X86_GDT_SIZE, %esp + + /* Align global descriptor table to 16-byte boundary */ + andl $0xfffffff0, %esp + + /* Set second parameter to setup_gdt */ + movl %esp, %edx + + /* gd->gd_addr = gd (Required to allow gd->xyz to work) */ + movl %eax, (%eax) + + /* Setup global descriptor table so gd->xyz works */ + call setup_gdt + /* Re-enter U-Boot by calling board_init_f_r */ call board_init_f_r
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h index d471367..fac93f0 100644 --- a/arch/x86/include/asm/global_data.h +++ b/arch/x86/include/asm/global_data.h @@ -54,7 +54,6 @@ typedef struct global_data { unsigned long relocaddr; /* Start address of U-Boot in RAM */ unsigned long start_addr_sp; /* start_addr_stackpointer */ unsigned long gdt_addr; /* Location of GDT */ - unsigned long new_gd_addr; /* New location of Global Data */ phys_size_t ram_size; /* RAM size */ unsigned long reset_status; /* reset status register at boot */ void **jt; /* jump table */ diff --git a/arch/x86/include/asm/init_helpers.h b/arch/x86/include/asm/init_helpers.h index 8afb443..ade694f 100644 --- a/arch/x86/include/asm/init_helpers.h +++ b/arch/x86/include/asm/init_helpers.h @@ -29,7 +29,6 @@ int display_dram_config(void); int init_baudrate_f(void); int calculate_relocation_address(void);
-int copy_gd_to_ram_f_r(void); int init_cache_f_r(void);
int set_reloc_flag_r(void); diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 6eb5180..17f27cb 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -41,6 +41,7 @@ enum { #else /* NOTE: If the above enum is modified, this define must be checked */ #define X86_GDT_ENTRY_32BIT_DS 3 +#define X86_GDT_NUM_ENTRIES 7 #endif
#define X86_GDT_SIZE (X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE) diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c index e5caf13..a13f5c0 100644 --- a/arch/x86/lib/board.c +++ b/arch/x86/lib/board.c @@ -36,6 +36,7 @@ #include <stdio_dev.h> #include <asm/u-boot-x86.h> #include <asm/relocate.h> +#include <asm/processor.h>
#include <asm/init_helpers.h> #include <asm/init_wrappers.h> @@ -121,7 +122,6 @@ init_fnc_t *init_sequence_f[] = { * initialise the CPU caches (to speed up the relocation process) */ init_fnc_t *init_sequence_f_r[] = { - copy_gd_to_ram_f_r, init_cache_f_r, copy_uboot_to_ram, clear_bss, diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c index 2f718d7..87c7263 100644 --- a/arch/x86/lib/init_helpers.c +++ b/arch/x86/lib/init_helpers.c @@ -83,18 +83,8 @@ int calculate_relocation_address(void) * requirements */
- /* Global Data is at top of available memory */ + /* Stack is at top of available memory */ dest_addr = gd->ram_size; - dest_addr -= GENERATED_GBL_DATA_SIZE; - dest_addr &= ~15; - gd->new_gd_addr = dest_addr; - - /* GDT is below Global Data */ - dest_addr -= X86_GDT_SIZE; - dest_addr &= ~15; - gd->gdt_addr = dest_addr; - - /* Stack is below GDT */ gd->start_addr_sp = dest_addr;
/* U-Boot is below the stack */ @@ -107,31 +97,6 @@ int calculate_relocation_address(void) return 0; }
-int copy_gd_to_ram_f_r(void) -{ - gd_t *ram_gd; - - /* - * Global data is still in temporary memory (the CPU cache). - * calculate_relocation_address() has set gd->new_gd_addr to - * where the global data lives in RAM but getting it there - * safely is a bit tricky due to the 'F-Segment Hack' that - * we need to use for x86 - */ - ram_gd = (gd_t *)gd->new_gd_addr; - memcpy((void *)ram_gd, gd, sizeof(gd_t)); - - /* - * Reload the Global Descriptor Table so FS points to the - * in-RAM copy of Global Data (calculate_relocation_address() - * has already calculated the in-RAM location of the GDT) - */ - ram_gd->gd_addr = ram_gd; - init_gd(ram_gd, (u64 *)gd->gdt_addr); - - return 0; -} - int init_cache_f_r(void) { /* Initialise the CPU cache(s) */ diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h index cc95e2b..8d3c21f 100644 --- a/include/configs/coreboot.h +++ b/include/configs/coreboot.h @@ -210,12 +210,11 @@ * (128kB + Environment Sector Size) malloc pool */ #define CONFIG_SYS_STACK_SIZE (32 * 1024) -#define CONFIG_SYS_INIT_SP_ADDR (256 * 1024 + 16 * 1024) +#define CONFIG_SYS_CAR_ADDR 0x19200000 +#define CONFIG_SYS_CAR_SIZE (16 * 1024) #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_MONITOR_LEN (256 * 1024) #define CONFIG_SYS_MALLOC_LEN (0x20000 + 128 * 1024) -/* Address of temporary Global Data */ -#define CONFIG_SYS_INIT_GD_ADDR (256 * 1024)
/* allow to overwrite serial and ethaddr */ diff --git a/include/configs/eNET.h b/include/configs/eNET.h index 4b1c219..28cf95b 100644 --- a/include/configs/eNET.h +++ b/include/configs/eNET.h @@ -168,16 +168,10 @@ #define CONFIG_SYS_STACK_SIZE (32 * 1024) #define CONFIG_SYS_CAR_ADDR 0x19200000 #define CONFIG_SYS_CAR_SIZE (16 * 1024) -#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_CAR_ADDR + \ - CONFIG_SYS_CAR_SIZE) #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_MONITOR_LEN (256 * 1024) #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SECT_SIZE + \ 128*1024) -/* Address of temporary Global Data */ -#define CONFIG_SYS_INIT_GD_ADDR CONFIG_SYS_CAR_ADDR - - /* allow to overwrite serial and ethaddr */ #define CONFIG_ENV_OVERWRITE

From: Graeme Russ graeme.russ@gmail.com
Signed-off-by: Graeme Russ graeme.russ@gmail.com Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/lib/board.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c index a13f5c0..c7d8960 100644 --- a/arch/x86/lib/board.c +++ b/arch/x86/lib/board.c @@ -164,9 +164,6 @@ init_fnc_t *init_sequence_r[] = { #ifdef CONFIG_MISC_INIT_R misc_init_r, #endif -#if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_CMD_IDE) - pci_init_r, -#endif #if defined(CONFIG_CMD_KGDB) kgdb_init_r, #endif

From: Graeme Russ graeme.russ@gmail.com
ilog2 is required by AHCI driver
Signed-off-by: Graeme Russ graeme.russ@gmail.com Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/include/asm/bitops.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index c7a38f2..5a7e4cb 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h @@ -351,6 +351,11 @@ static __inline__ int ffs(int x) } #define PLATFORM_FFS
+static inline int __ilog2(unsigned int x) +{ + return generic_fls(x) - 1; +} + /** * hweightN - returns the hamming weight of a N-bit word * @x: the word to weigh

Hi Graeme,
On Tue, Nov 27, 2012 at 5:38 PM, Simon Glass sjg@chromium.org wrote:
From: Graeme Russ graeme.russ@gmail.com
Signed-off-by: Graeme Russ graeme.russ@gmail.com Signed-off-by: Simon Glass sjg@chromium.org
Makefile | 1 + arch/x86/cpu/config.mk | 3 ++- examples/standalone/Makefile | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index 1a17be9..2ad5cc5 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,7 @@ VERSION_FILE = $(obj)include/generated/version_autogenerated.h
HOSTARCH := $(shell uname -m | \ sed -e s/i.86/x86/ \
-e s/x86_64/x86/ \ -e s/sun4u/sparc64/ \ -e s/arm.*/arm/ \ -e s/sa110/arm/ \
diff --git a/arch/x86/cpu/config.mk b/arch/x86/cpu/config.mk index c00f867..092de68 100644 --- a/arch/x86/cpu/config.mk +++ b/arch/x86/cpu/config.mk @@ -23,7 +23,8 @@
CROSS_COMPILE ?= i386-linux-
-PLATFORM_CPPFLAGS += -DCONFIG_X86 -D__I386__ -march=i386 -Werror +PLATFORM_CPPFLAGS += -DCONFIG_X86 -D__I386__ -march=i386 -Werror -m32 +PLATFORM_LDFLAGS += -m elf_i386
# DO NOT MODIFY THE FOLLOWING UNLESS YOU REALLY KNOW WHAT YOU ARE DOING! LDPPFLAGS += -DRESET_SEG_START=0xffff0000 diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index baaa2fb..7c1ea5c 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -98,7 +98,7 @@ $(ELF): $(obj)%: $(obj)%.o $(LIB) $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \ -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
-L$(gcclibdir) -lgcc
-L$(USE_PRIVATE_LIBGCC) -lgcc
This forces all archs to use a private libgcc here, right? Is that the intention? It seems to break some of the powerpc boards with my eldk-5.2.1 toolchain. I'm not sure of the runes to get U-Boot to compile with a 64-bit toolchain. I think it might be best to completely get to the bottom of this rather than applying part of this patch.
So please can you point me to the x86 compiler you tested with?
$(SREC): $(obj)%.srec: $(obj)% -- 1.7.7.3
Regards, Simon

Hi Simon,
On Thu, Nov 29, 2012 at 6:46 AM, Simon Glass sjg@chromium.org wrote:
Hi Graeme,
On Tue, Nov 27, 2012 at 5:38 PM, Simon Glass sjg@chromium.org wrote:
From: Graeme Russ graeme.russ@gmail.com
[snip]
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index baaa2fb..7c1ea5c 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -98,7 +98,7 @@ $(ELF): $(obj)%: $(obj)%.o $(LIB) $(LD) $(LDFLAGS) -g -Ttext
$(CONFIG_STANDALONE_LOAD_ADDR) \
-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $<
$(LIB) \
-L$(gcclibdir) -lgcc
-L$(USE_PRIVATE_LIBGCC) -lgcc
This forces all archs to use a private libgcc here, right? Is that the intention? It seems to break some of the powerpc boards with my
Eeep - no, that was not the intent. I did this so long ago I can't even remember why I did the USE_PRIVATE_LIBGCC
eldk-5.2.1 toolchain. I'm not sure of the runes to get U-Boot to compile with a 64-bit toolchain. I think it might be best to completely get to the bottom of this rather than applying part of this patch.
So please can you point me to the x86 compiler you tested with?
All my building is done with the latest gcc the ships with Fedora 17 (can't recall the version off the top of my head)
Regards,
Graeme

Hi Simon,
On Thu, Nov 29, 2012 at 8:18 AM, Graeme Russ graeme.russ@gmail.com wrote:
Hi Simon,
On Thu, Nov 29, 2012 at 6:46 AM, Simon Glass sjg@chromium.org wrote:
Hi Graeme,
On Tue, Nov 27, 2012 at 5:38 PM, Simon Glass sjg@chromium.org wrote:
From: Graeme Russ graeme.russ@gmail.com
[snip]
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index baaa2fb..7c1ea5c 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -98,7 +98,7 @@ $(ELF): $(obj)%: $(obj)%.o $(LIB) $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \ -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
-L$(gcclibdir) -lgcc
-L$(USE_PRIVATE_LIBGCC) -lgcc
This forces all archs to use a private libgcc here, right? Is that the intention? It seems to break some of the powerpc boards with my
Eeep - no, that was not the intent. I did this so long ago I can't even remember why I did the USE_PRIVATE_LIBGCC
I've had a closer look, and I think this part of the patch is really a hangover from commit 36b2409a3d469b5133d105fa12089429a1900bde (x86: Wrap small helper functions from libgcc to avoid an ABI mismatch)
So the proper solution would be to break this patch into two patches - one that fixes the libgcc/abi mismatch for examples/standalone and one that fixes building on 64-bit build machines.
There might have been some discussion about the libgcc/regparm mismatch, but I can't recall. I'm wondering if the option of dumping regparm was considered. It really only impacts the code where there is a boundary between .S and .c files and inline asm like in arch/x86/cpu/interrupts.c Overall, it might be a cleaner solution
Regards,
Graeme
participants (2)
-
Graeme Russ
-
Simon Glass