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 when linking you must find the section that defines the symbol, and ensure that the linker has not removed the section.

You can do this with the --keep="section_id" and --symbols options. For example, if object(section) is the section containing the symbol, enter:

armlink --cpu=8-A.32 --keep="object(section)" --symbols s.o --output=s.axf      


You can also run fromelf -s on the resultant image.

As an example, do the following:


  1. Create the file s.c containing the following source code:
    long long array[10] __attribute__ ((section ("ARRAY")));
    int main(void)
        return sizeof(array);
  2. Compile the source:

    armclang --target=arm-arm-none-eabi -march=armv8-a -c s.c -o s.o

  3. Link the object s.o, keeping the ARRAY symbol and displaying the symbols:

    armlink --cpu=8-A.32 --keep="s.o(ARRAY)" --map --symbols 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