[U-Boot] Some M68K boards are depending the specific order of libraries

Hi, M68K maintainers.
I noticed at least some M68K boards are expecting the specific order of libraries for the link stage.
To confirm this problem, check out the current u-boot/master. (commit f44483b57c49282299da0e5c10073b909cdad979)
And then build, for example, "cobra5272" board. $ make cobra5272 CROSS_COMPILE=m68k-linux-
The build should succeed.
And then, modify the top Makefile as follows (omit $(sort ...) function)
--- a/Makefile +++ b/Makefile @@ -288,7 +288,7 @@ LIBS-$(CONFIG_PPC) += arch/powerpc/cpu/ LIBS-y += board/$(BOARDDIR)/
LIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y)) -LIBS := $(addprefix $(obj),$(sort $(LIBS-y))) +LIBS := $(addprefix $(obj),$(LIBS-y)) .PHONY : $(LIBS)
And then, build again $ make cobra5272 CROSS_COMPILE=m68k-linux- <<snip>> arch/m68k/cpu/mcf52x2/start.o: In function `_start': /home/yamada/workspace/u-boot-org/arch/m68k/cpu/mcf52x2/start.S:201:(.text+0x448): relocation truncated to fit: R_68K_PC16 against symbol `cpu_init_f' defined in .text.cpu_init_f section in arch/m68k/cpu/mcf52x2/built-in.o /home/yamada/workspace/u-boot-org/arch/m68k/cpu/mcf52x2/start.S:202:(.text+0x44c): relocation truncated to fit: R_68K_PC16 against symbol `board_init_f' defined in .text.board_init_f section in arch/m68k/lib/built-in.o arch/m68k/cpu/mcf52x2/start.o: In function `_exc_handler': /home/yamada/workspace/u-boot-org/arch/m68k/cpu/mcf52x2/start.S:300:(.text+0x4da): relocation truncated to fit: R_68K_PC16 against symbol `exc_handler' defined in .text.exc_handler section in arch/m68k/lib/built-in.o arch/m68k/cpu/mcf52x2/start.o: In function `_int_handler': /home/yamada/workspace/u-boot-org/arch/m68k/cpu/mcf52x2/start.S:308:(.text+0x4fc): relocation truncated to fit: R_68K_PC16 against symbol `int_handler' defined in .text.int_handler section in arch/m68k/lib/built-in.o make[1]: *** [u-boot] Error 1 make[1]: Leaving directory `/home/yamada/workspace/u-boot-org' make: *** [cobra5272] Error 2
The build will fail with error messages " relocation truncated to fit: R_68K_PC16 against symbol"
What is this error?
And I'd say such boards are working by luck. This means, if you add a new library, or delete an obsolete library, or change the order of libraries, some M68K boards might get broken all of sudden, with totally unrelated cause.
So I'm thinking the root cause of some M68K boards should be fixed. For now it is only luckily(unluckily?) hidden.
So, I hope M68K experts will check this.
Best Regards Masahiro Yamada

Dear Masahiro Yamada,
On 12/11/2013 10:32 AM, Masahiro Yamada wrote:
<snip>
And then, build again $ make cobra5272 CROSS_COMPILE=m68k-linux- <<snip>> arch/m68k/cpu/mcf52x2/start.o: In function `_start': /home/yamada/workspace/u-boot-org/arch/m68k/cpu/mcf52x2/start.S:201:(.text+0x448): relocation truncated to fit: R_68K_PC16 against symbol `cpu_init_f' defined in .text.cpu_init_f section in arch/m68k/cpu/mcf52x2/built-in.o /home/yamada/workspace/u-boot-org/arch/m68k/cpu/mcf52x2/start.S:202:(.text+0x44c): relocation truncated to fit: R_68K_PC16 against symbol `board_init_f' defined in .text.board_init_f section in arch/m68k/lib/built-in.o arch/m68k/cpu/mcf52x2/start.o: In function `_exc_handler': /home/yamada/workspace/u-boot-org/arch/m68k/cpu/mcf52x2/start.S:300:(.text+0x4da): relocation truncated to fit: R_68K_PC16 against symbol `exc_handler' defined in .text.exc_handler section in arch/m68k/lib/built-in.o arch/m68k/cpu/mcf52x2/start.o: In function `_int_handler': /home/yamada/workspace/u-boot-org/arch/m68k/cpu/mcf52x2/start.S:308:(.text+0x4fc): relocation truncated to fit: R_68K_PC16 against symbol `int_handler' defined in .text.int_handler section in arch/m68k/lib/built-in.o make[1]: *** [u-boot] Error 1 make[1]: Leaving directory `/home/yamada/workspace/u-boot-org' make: *** [cobra5272] Error 2
The build will fail with error messages " relocation truncated to fit: R_68K_PC16 against symbol"
What is this error?
It is a linker error stating that the specific call (for example 'bsr cpu_init_f' @start.S:201) will not work cause (and this is guessing) the PC relative jump with 16 bit offset can not work cause the symbol cpu_init_f is to far away. I had similiar issue in linux kernel for avr32 these days. I found a work around, please read https://lkml.org/lkml/2013/10/24/156 to understand it.
Best regards
Andreas Bießmann

Hi Andreas,
The build will fail with error messages " relocation truncated to fit: R_68K_PC16 against symbol"
What is this error?
It is a linker error stating that the specific call (for example 'bsr cpu_init_f' @start.S:201) will not work cause (and this is guessing) the PC relative jump with 16 bit offset can not work cause the symbol cpu_init_f is to far away. I had similiar issue in linux kernel for avr32 these days. I found a work around, please read https://lkml.org/lkml/2013/10/24/156 to understand it.
Thanks!
I could understand well. But, I am not a M68K expert, nor have a M68K board. So, I will wait for a while until M68K maintainers catch this.
Best Regards Masahiro Yamada
participants (2)
-
Andreas Bießmann
-
Masahiro Yamada