[U-Boot] How to build multiple object files from one source?
Alexey Brodkin
Alexey.Brodkin at synopsys.com
Fri Jun 8 19:18:34 UTC 2018
Hello,
I've been playing with libgcc sources imported in U-Boot [1] and so far
for some platforms it works but for some doesn't.
The problem I just discovered is how libgcc's assembly is composed.
It has a couple of not very usual features:
1. The same labels used in different functions
2. A lot of functions are collected in the same source file [2]
3. Every function is wrapped in individual #ifdef
4. Very special target is used for compilation [3] which iterates through
the list of all those per-function defines LIB1ASMFUNCS [4] and compiles
the same one lib1funcs.S many times each time with just one define
provided and creates similarly named .o file.
Then all objects are easily collected in libgcc.s because all labels
are already resolved into offsets.
And I'm wondering if something similar could be achieved in U-Boot?
Ideal solution is reproduction of libgcc's original approach but that
requires implementation of my own build "script" which might deal with
input and output of different names. Because obviously "obj-y += xxx"
won't work.
That's what I want:
Source file: lib1funcs.S
Object files: _mulsi3.o, _umulsidi3.o, _umulsi3_highpart.o etc.
[that I may achieve with creating of multiple
symlinks to original lib1funcs.S]
And what's even more important important I need to set per-file ASFLAGS:
ASFLAGS__mulsi3.o = -DL_mulsi3,
ASFLAGS__umulsidi3.o = -DL_umulsidi3,
ASFLAGS__umulsi3_highpart.o = -DL_umulsi3_highpart etc.
If that's not possible probably I'll need to split that combined lib1funcs.S
into many files but this is:
a) Pretty painful as we're talking about ~15 files
b) Maintenance, i.e. the next import from future versions of GCC will be
even more painful as lib1funcs.S might be restructured etc
Any ideas?
-Alexey
[1] https://patchwork.ozlabs.org/patch/926522/
[2] https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/arc/lib1funcs.S
[3] https://github.com/gcc-mirror/gcc/blob/master/libgcc/Makefile.in#L473
[4] https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/arc/t-arc#L24
More information about the U-Boot
mailing list