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="
" and section_id
--symbols
options. For example, if
is the section containing the symbol, enter:object
(section
)
armlink --cpu=8-A.32 --keep="object
(section
)" --symbols s.o --output=s.axf
Note
You can also runfromelf -s
on the resultant
image.
As an example, do the following:
Procedure
-
Create the file s.c containing the
following source code:
long long array[10] __attribute__ ((section ("ARRAY"))); int main(void) { return sizeof(array); }
- Compile the source:
armclang --target=arm-arm-none-eabi -march=armv8-a -c s.c -o s.o
-
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
-
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
... Execution Region ER_RW (Base: 0x00008360, Size: 0x00000050, Max: 0xffffffff, ABSOLUTE) Base Addr Size Type Attr Idx E Section Name Object 0x00008360 0x00000050 Data RW 3 ARRAY s.o
This shows that the array is placed in execution region ER_RW.