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 --cpu=8-A.32 --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 array[10] __attribute__ ((section ("ARRAY")));
    
    int main()
    {
        return sizeof(array);	
    }
    
  2. Compile the source:

    armclang -target armv8a-arm-none-eabi -c s.c -o s.o

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

    armlink --cpu=8-A.32 --keep=s.o(ARRAY) --map s.o --output=s.axf

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

    ...
    Execution Region ER_RW (Base: 0x000083a8, Size: 0x00000028, Max: 0xffffffff, ABSOLUTE)
    
    Base Addr    Size         Type   Attr      Idx    E Section Name        Object
    
    0x000083a8   0x00000028   Data   RW            4    ARRAY               s.o
    

    This shows that the array is placed in execution region ER_RW.

Was this page helpful? Yes No