Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNU build sets GP to _f_sdata instead of __SDATA_BEGIN__ #148

Open
iguryanov opened this issue Mar 25, 2021 · 0 comments
Open

GNU build sets GP to _f_sdata instead of __SDATA_BEGIN__ #148

iguryanov opened this issue Mar 25, 2021 · 0 comments
Assignees
Labels

Comments

@iguryanov
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants