u-boot-brain/arch/arm/mach-imx/imx8m
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
..
clock_imx8mm.c iMX8M: Add support to enable CONFIG_IMX_HAB 2021-04-08 09:18:29 +02:00
clock_imx8mq.c iMX8M: Add support to enable CONFIG_IMX_HAB 2021-04-08 09:18:29 +02:00
clock_slice.c imx8m: update clock root and fix core_sel 2020-05-01 13:46:21 +02:00
imximage-8mm-lpddr4.cfg imx8m: add image cfg for i.MX8MM lpddr4 2019-10-08 16:36:36 +02:00
imximage-8mn-ddr4.cfg imx8m: add i.MX8MN ddr4 image cfg file 2019-11-05 10:27:18 +01:00
imximage-8mn-lpddr4.cfg ARM: imx: add i.MX8MN lpddr4 image cfg file 2021-01-23 14:01:59 +01:00
imximage-8mp-lpddr4.cfg imx: imx8m: add imximage-8mp-lpddr4.cfg 2020-01-08 13:20:09 +01:00
imximage.cfg imx: imx8m: introduce imximage cfg file 2019-01-01 14:12:18 +01:00
Kconfig ARM:imx:imx8mq-cm: Add support for Ronetix iMX8MQ-CM 2021-05-02 12:46:54 +02:00
lowlevel_init.S imx8m: lowlevel_init: tune alignment 2021-01-23 11:30:31 +01:00
Makefile imx: imx8mp: add basic clock 2020-01-08 13:20:08 +01:00
soc.c ARM: make gd a function call for LTO and set via set_gd() 2021-05-24 14:21:30 -04:00