EmbDev.net

Forum: ARM programming with GCC/GNU tools Linker jargon queries


von Thomas F. (thomas_f)


Rate this post
useful
not useful
Hello ,

I was just going through some linker scripts and could do with some 
clarifications.
1
.bss (NOLOAD) :
2
  {
3
  __bss_start = . ;
4
  __bss_start__ = . ;
5
  *(.bss)
6
  *(.bss.*)
7
  *(.gnu.linkonce.b*)
8
  *(COMMON)
9
  . = ALIGN(4);
10
  } > RAM
11
12
  . = ALIGN(4);
13
  __bss_end__ = . ;
14
  PROVIDE (__bss_end = .);

1).bss (NOLOAD) : is this strictly necessary ? I think just tells the 
linker not to place this in ROM ? But if there is no >AT ROM , the 
linker would not do it anyway.Is this redundant ,or is it required by 
the gcc linker ?

2) __bss_start = . ;
   _bss_start_ = . ;
Why are there 2 "labels" for the same location ? _bss_start_  is used 
in the startup asm to zero the contents of .bss ,but I could not find 
__bss_start used anywhere.

1
.arm
2
.section .STACK, "w"
3
.align 3
4
Stack_Mem:
5
.space Stack_Size
6
.equ Stack_Top, Stack_Mem + Stack_Size

4).align 3
Should it be .align 4 ? Align on a word boundary ?

TIA
Thomas

von Jörg W. (dl8dtl) (Moderator)


Rate this post
useful
not useful
Thomas Fernando wrote:

> 1).bss (NOLOAD) : is this strictly necessary ?

I didn't look up it in the linker reference, but I think it's
just telling the linker which section flags to place in the
output file.  An ELF file section can be either LOAD or NOLOAD.

> Why are there 2 "labels" for the same location ?

My guess is that it's for historical reasons, "just in case".

> 4).align 3
> Should it be .align 4 ? Align on a word boundary ?

I think this means to align on an 8-byte boundary, 2^3.

von Thomas F. (thomas_f)


Rate this post
useful
not useful
Thanks much for your reply Jorg.

Jörg Wunsch wrote:
>I didn't look up it in the linker reference, but I think it's
>just telling the linker which section flags to place in the
>output file.
Ok,is this the same as "which section flags to place in the
ROM".Since the output file (.ihex i.e. not ELF) will be be finally 
flashed in the ROM.Sorry to sound a bit pedantic,but I am just trying to 
clear my doubts.
>
> My guess is that it's for historical reasons, "just in case".
>
Ok,so I did not miss anything much.

> I think this means to align on an 8-byte boundary, 2^3.
Yes, I just read it in the assembler directives,now it is clear.

Thanks
Thomas

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.