arc: Fix final linkage with Elf32 tools
authorAlexey Brodkin <Alexey.Brodkin@synopsys.com>
Thu, 15 Feb 2018 12:34:58 +0000 (15:34 +0300)
committerAlexey Brodkin <abrodkin@synopsys.com>
Thu, 15 Feb 2018 12:44:47 +0000 (15:44 +0300)
commitd53b128df40d8b2f5dd87cac194163fca2bc17ed
tree5217e49ad792ed2ee54c89a443dee2e3a125331f
parent0c502b6c176281a096a23803e517b19e964485f1
arc: Fix final linkage with Elf32 tools

ARC Elf32 tools by default enable usage of so-called "small data"
section or in ARC PRM parlance "GP-relative addressing".

The idea is to put up to 2kB of frequently used data into a separate
location and use indirect addressing via dedicated core register (GP).
Where GP is used as a base for offset calculation.

And so if "-msdata" toggle is passed to the compiler either explicitly
or implicitly (that's Elf32 tools case) it will try to put some data
in that "small data" area and then to calculate real offset from GP
to be encoded in instructions we need to know the base value which
liker gets from __SDATA_BEGIN__ symbol in hte linker script.

In U-Boot we don't use that feature and linker script doesn't define
__SDATA_BEGIN__ which gives us the following linkage error if we use
Elf32 tools:
------------------------->8-------------------
  LD      u-boot
.../bin/arc-elf32-ld.bfd: Error: Linker symbol __SDATA_BEGIN__ not found
.../bin/arc-elf32-ld.bfd: final link failed: Bad value
------------------------->8-------------------

Note if uClibc or glibc tools are used that problem doesn't happen
because usage of "small data section" is disabled by default as not very
useful for bigger executables. Moreover GP is just another name of r26
so we're loosing 1 core register which is not used by the compiler as a
generic register with "-msdata".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
arch/arc/config.mk