You copied the Doc URL to your clipboard.

How to find where a symbol is placed when linking

To find where a symbol is placed in an ELF image file when linking, use the --keep=section_id and --map options to view the image memory map. For example, if object(section) is the section containing the symbol, enter:

armlink --keep=object(section) --map s.o --output=s.axf

The memory map shows where the section containing the symbol is placed.

Example

Do the following:

  1. Create the file s.c containing the following source code:

    long long altstack[10] __attribute__ ((section ("STACK"), zero_init));
    
    int main()
    {
        return sizeof(altstack);	
    }
    
  2. Compile the source:

    armcc -c s.c -o s.o

  3. Link the object s.o, keeping the STACK symbol and displaying the image memory map:

    armlink --keep=s.o(STACK) --map s.o --output=s.axf

  4. Locate the STACK symbol in the output, for example:

    ...
    Execution Region ER_RW (Base: 0x000081c8, Size: 0x00000000, Max: 0xffffffff, ABSOLUTE)
    
    **** No section assigned to this execution region ****
    
    
    Execution Region ER_ZI (Base: 0x000081c8, Size: 0x000000b0, Max: 0xffffffff, ABSOLUTE)
    
    Base Addr    Size         Type   Attr      Idx    E Section Name        Object
    
    0x000081c8   0x00000060   Zero   RW           42    .bss                libspace.o(c_4.l)
    0x00008228   0x00000050   Zero   RW            2    STACK               s.o
    

    This shows that the stack is placed in execution region ER_ZI.

Was this page helpful? Yes No