mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-20 00:48:52 +09:00
![Alexey Brodkin](/assets/img/avatar_default.png)
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>
60 lines
1.1 KiB
Makefile
60 lines
1.1 KiB
Makefile
#
|
|
# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0+
|
|
#
|
|
|
|
ifndef CONFIG_CPU_BIG_ENDIAN
|
|
CONFIG_SYS_LITTLE_ENDIAN = 1
|
|
else
|
|
CONFIG_SYS_BIG_ENDIAN = 1
|
|
endif
|
|
|
|
ifdef CONFIG_SYS_LITTLE_ENDIAN
|
|
ARC_CROSS_COMPILE := arc-linux-
|
|
PLATFORM_LDFLAGS += -EL
|
|
PLATFORM_CPPFLAGS += -mlittle-endian
|
|
endif
|
|
|
|
ifdef CONFIG_SYS_BIG_ENDIAN
|
|
ARC_CROSS_COMPILE := arceb-linux-
|
|
PLATFORM_LDFLAGS += -EB
|
|
PLATFORM_CPPFLAGS += -mbig-endian
|
|
endif
|
|
|
|
ifeq ($(CROSS_COMPILE),)
|
|
CROSS_COMPILE := $(ARC_CROSS_COMPILE)
|
|
endif
|
|
|
|
ifdef CONFIG_ARC_MMU_VER
|
|
CONFIG_MMU = 1
|
|
endif
|
|
|
|
ifdef CONFIG_CPU_ARC750D
|
|
PLATFORM_CPPFLAGS += -mcpu=arc700
|
|
endif
|
|
|
|
ifdef CONFIG_CPU_ARC770D
|
|
PLATFORM_CPPFLAGS += -mcpu=arc700 -mlock -mswape
|
|
endif
|
|
|
|
ifdef CONFIG_CPU_ARCEM6
|
|
PLATFORM_CPPFLAGS += -mcpu=arcem
|
|
endif
|
|
|
|
ifdef CONFIG_CPU_ARCHS34
|
|
PLATFORM_CPPFLAGS += -mcpu=archs
|
|
endif
|
|
|
|
ifdef CONFIG_CPU_ARCHS38
|
|
PLATFORM_CPPFLAGS += -mcpu=archs
|
|
endif
|
|
|
|
PLATFORM_CPPFLAGS += -ffixed-r25 -D__ARC__ -gdwarf-2 -mno-sdata
|
|
|
|
# Needed for relocation
|
|
LDFLAGS_FINAL += -pie
|
|
|
|
# Load address for standalone apps
|
|
CONFIG_STANDALONE_LOAD_ADDR ?= 0x82000000
|