Skip to contentSkip to conversation

What's going on here: global offset table

U-Boot-Users ming lei 2 participants 2 messages Nov 1, 2005

lore
Share & tools
lore

ming lei

author
#0 lore raw

I am a newbie to u-boot. I found some macros in file u-boot-1.1.3\include\ppc_asm.tmpl

#define START_GOT			\
	.section	".got2","aw";	\

.LCTOC1 = .+32768

#define END_GOT \
.text

#define GET_GOT				\
	bl	1f		;	\
	.text	2		;	\
0:	.long	.LCTOC1-1f	;	\
	.text			;	\
1:	mflr	r14		;	\
	lwz	r0,0b-1b(r14)	;	\
	add	r14,r0,r14	;

#define GOT_ENTRY(NAME) .L_ ## NAME = . - .LCTOC1 ; .long NAME

#define GOT(NAME) .L_ ## NAME (r14)

in file u-boot-1.1.3\cpu\mpc8260\start.S, I found some statements as follows START_GOT

	GOT_ENTRY(_GOT2_TABLE_)
	GOT_ENTRY(_FIXUP_TABLE_)

	GOT_ENTRY(_start)
	GOT_ENTRY(_start_of_vectors)
	GOT_ENTRY(_end_of_vectors)
	GOT_ENTRY(transfer_to_handler)

	GOT_ENTRY(__init_end)
	GOT_ENTRY(_end)
	GOT_ENTRY(__bss_start)

#if defined(CONFIG_HYMOD)
GOT_ENTRY(environment)
#endif
END_GOT

I thougt that these statement will be something as follows after preprocessed by gasp
.section ".got2","aw";
.LCTOC1 = .+32768

.L___GOT2_TABLE _= . - .LCTOC1;
.long _GOT2_TABLE_
................
...............

My questions are:
(1) what is the meaning of the "LCT0C1"? is ".LCTOC1" a symbol or a
directive ? if ".LCTOC1" is a symbol ,why I can not see it using
nm or objdump?

(2) what is the meaning of the ".L__GOT2_TABLE_". what is the relation between ".L__GOT2_TABLE_" and "_GOT2_TABLE_" defined in u-boot.lds?

THANKS!

#1 lore raw
Quoted 4 lines · In message <[email protected]> you wrote:

(1) what is the meaning of the "LCT0C1"? is ".LCTOC1" a symbol or a
directive ? if ".LCTOC1" is a symbol ,why I can not see it using
nm or objdump?

It's a local symbol. [This answers both questions.]

Quoted 2 lines

(2) what is the meaning of the ".L__GOT2_TABLE_". what is the relation between ".L__GOT2_TABLE_" and "_GOT2_TABLE_" defined in u-boot.lds?

I recommend to read the C source (instead of generated assembler code), which has some comments.

Also reading some background information about the GOT may be helpful.

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Those who hate and fight must stop themselves -- otherwise it is  not
stopped.
	-- Spock, "Day of the Dove", stardate unknown