u-boot/arch/arm/cpu
Marek Behún 86c5e21013 ARM: make gd a function call for LTO and set via set_gd()
On ARM, the gd pointer is stored in registers r9 / x18. For this the
-ffixed-r9 / -ffixed-x18 flag is used when compiling, but using global
register variables causes errors when building with LTO, and these
errors are very difficult to overcome.

Richard Biener says [1]:
  Note that global register vars shouldn't be used with LTO and if they
  are restricted to just a few compilation units the recommended fix is
  to build those CUs without -flto.

We cannot do this for U-Boot since all CUs use -ffixed-reg flag.

It seems that with LTO we could in fact store the gd pointer differently
and gain performance or size benefit by allowing the compiler to use
r9 / x18. But this would need more work.

So for now, when building with LTO, go the clang way, and instead of
declaring gd a global register variable, we make it a function call via
macro.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68384

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-24 14:21:30 -04:00
..
arm11 common: Drop net.h from common header 2020-05-18 17:33:31 -04:00
arm720t rename symbol: CONFIG_TEGRA -> CONFIG_ARCH_TEGRA 2020-05-15 14:47:35 -04:00
arm920t reset: Remove addr parameter from reset_cpu() 2021-03-02 14:03:02 -05:00
arm926ejs ARM: make gd a function call for LTO and set via set_gd() 2021-05-24 14:21:30 -04:00
arm946es reset: Remove addr parameter from reset_cpu() 2021-03-02 14:03:02 -05:00
arm1136 common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
arm1176 SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
armv7 treewide: Convert macro and uses of __section(foo) to __section("foo") 2021-05-24 14:21:30 -04:00
armv7m reset: Remove addr parameter from reset_cpu() 2021-03-02 14:03:02 -05:00
armv8 treewide: Convert macro and uses of __section(foo) to __section("foo") 2021-05-24 14:21:30 -04:00
pxa reset: Remove addr parameter from reset_cpu() 2021-03-02 14:03:02 -05:00
sa1100 reset: Remove addr parameter from reset_cpu() 2021-03-02 14:03:02 -05:00
Makefile SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
u-boot-spl.lds spl: fix linker size check off-by-one errors 2019-05-05 08:48:50 -04:00
u-boot.lds ARM: Specify aligned address for secure section instead of using attributes 2018-09-07 09:11:42 -04:00