GNU build sets GP to _f_sdata instead of __SDATA_BEGIN__
iguryanov opened this issue · 0 comments
Issue Summary
- Type: Bug
- Category: Library
- Priority: Low
- Release Version: 2019.06
Bug
Development Environment
-
HOST OS
All OS -
TOOLCHAIN
ARC GNU 2020.03=9. -
BOARD
Customer's board, irrelevant. -
ARC CORE
EM9D.
Bug Description
gcc builds use linker scripts with both _f_sdata
and __SDATA_BEGIN__
.
Normally they are the same in our scripts.
Native GNU toolchain startup uses __SDATA_BEGIN__
to configure %GP register.
But embARC startup sticks to MWDT agreement and uses _f_sdata
.
This works ok until user decides to put __SDATA_BEGIN__
in the middle of the section to extend it's range.
(GP-based offset is signed). And linker uses __SDATA_BEGIN__
to calculate relocations and actual offsets.
So when user changes related line in the script to something like this - __SDATA_BEGIN__ = . + 0x100;
small data access becomes wrong. Runtime offsets will be 0x100 less (easily driving into negative zone),
while startup still sets %GP to the beginning of small data section.
Question
Is it possible to change arc_startup.s in a way that for GCC builds it will choose __SDATA_BEGIN__
for GP?