In GNU Assembler, what does a dot signify at the beginning of a name?

9.1k views Asked by At

The following is a line from a microprocessor startup file, intended for input into the GNU assembler as:

.section  .isr_vector,"a",%progbits

Does the dot at the beginning of the name .isr_vector mean anything special? PS: This name is referenced by the GNU linker ld.

EDIT:

This name also shows up in readelf output as a Section Header:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  ...
  [ 1] .isr_vector       PROGBITS        08000000 008000 0001ac 00   A  0   0  1
2

There are 2 answers

3
randomusername On BEST ANSWER

A dot preceding a name is either an assembler directive or a local label.

An assembler directive tells as to do something special, for example .text tells it to generate data in the text section of the object file (for things like code and literals that cannot be changed). There's also directives like .space which tell it to allocate empty space in the object file, this is often used to allocate space in the bss section.

On the other hand, we have local labels like .L1 that are used in the code but aren't meant to be exported in the object file and should be hidden from the symbol table.

2
Han XIAO On

However, I don't agree that it is a local variable. Only symbols prefixing .L mean local variables.(The naming convention for local symbol is portable, but some convention is machine-dependent). Type info as, navigate to chapter Symbols and sub-chapter Symbol-names, and you will get it.

I think it is just a symbol, which is the name for a section, and this name is referred in the linker script. You said that you saw this in the microprocessor start-up file. Of course, linking microprocessor start-up files needs linker script. And this name is just used for reference, which may sound weird but is real.