Skip to contentSkip to conversation

display the entry point when compiling a stand-alone program

PATCH New Timur Tabi 2 participants 3 messages Jun 10, 2010 – Jun 11, 2010

lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

PATCH 1/1 display the entry point when compiling a stand-alone program

Contrary to popular belief, the entry point for a stand-alone program is not consistent. The only way to know for sure is to use the nm program and search for the entry point function. So we update the Makefile build rule to display this entry point after the ELF image is created.

---
 examples/standalone/Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
examples/standalone/Makefile +1 -0
index 6ea3b93..d6a01ea 100644
@@ -83,6 +83,7 @@ $(obj)%:	$(obj)%.o $(LIB)
 		$(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \
 			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
 			-L$(gcclibdir) -lgcc
+		$(NM) $@ | grep $@
 
 $(SREC):
 $(obj)%.srec:	$(obj)%
Signature · 1 line
1.7.0.1
#1 lore raw

PATCH 1/1 display the entry point when compiling a stand-alone program

Hi Timur,

Quoted 6 lines

Contrary to popular belief, the entry point for a stand-alone program is not consistent. The only way to know for sure is to use the nm program and search for the entry point function. So we update the Makefile build rule to display this entry point after the ELF image is created.

I was thinking along the same lines but decided that this is not the correct solution but only sweetening the fall ;)

We should concentrate on creating a correct linker script so that the entry point ends up where we want it to be, namely at STANDALONE_LOAD_ADDR.

Can you have a look at this and maybe solve the problem for good then?

Thanks!
Detlev

Signature · 7 lines
Der erfahrene Politiker hantiert mit Werten wie mit Fahnen. Man tut so,
als ob klar sei,  was gerecht ist,  und unterstellt jedem,  der dar?ber
diskutieren will, er sei dagegen.        -- Norbert Bolz
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
author
#2 lore raw

PATCH 1/1 display the entry point when compiling a stand-alone program

Quoted 5 lines · Detlev Zundel

We should concentrate on creating a correct linker script so that the entry point ends up where we want it to be, namely at STANDALONE_LOAD_ADDR.

Can you have a look at this and maybe solve the problem for good then?

I have no idea how to do that. I don't know diddly about linker scripts.