From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Tyser Date: Tue, 15 Jun 2010 15:15:05 -0500 Subject: [U-Boot] [PATCH] examples/standalone: Remove relocation compile flags for PowerPC In-Reply-To: <4C17D851.4010307@freescale.com> References: <1276572325-12642-1-git-send-email-ptyser@xes-inc.com> <4C17CE2F.9050208@freescale.com> <4C17CEEC.8000409@freescale.com> <1276630601.32134.1501.camel@petert> <4C17D851.4010307@freescale.com> Message-ID: <1276632905.32134.1535.camel@petert> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, 2010-06-15 at 14:45 -0500, Timur Tabi wrote: > Peter Tyser wrote: > > Was commenting out the 'ifeq' above necessary? It shouldn't be, so my > > first question would be why it was needed. > > Probably because I was using an older U-Boot. When I switch to the latest > code, it compiles fine. > > However, my entry point is not at 40000: > > $ nm -n examples/standalone/flash_wp > 00040000 t command_exit > 000400c4 t is_locked > 00040184 T flash_wp > 000403d0 T dummy > > 'flash_wp' should be at 40000. command_exit and is_locked are two functions > in my code. command_exit, however, is not the first function, it's the third. I think by default its not possible to guarantee function order in gcc's output if a file contains multiple functions. We could create a basic linker script... I think we could also do it with some gcc/ld-foo like: --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -78,6 +78,7 @@ CPPFLAGS += -I.. # inconsistent. ifeq ($(ARCH),powerpc) CFLAGS := $(filter-out $(RELFLAGS),$(CFLAGS)) +CFLAGS += -fno-toplevel-reorder endif all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF) @@ -88,7 +89,7 @@ $(LIB): $(obj).depend $(LIBOBJS) $(ELF): $(obj)%: $(obj)%.o $(LIB) - $(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \ + $(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) -sort-common \ -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \ -L$(gcclibdir) -lgcc Could you try the above change with your flash_wp test case? Or make the flash_wp app public? It should put the first function@the base of the image in theory. Best, Peter