diff options
author | Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com> | 2019-05-29 15:33:05 -0700 |
---|---|---|
committer | Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> | 2019-12-13 13:27:17 -0800 |
commit | 4f617750e838f995b7bb09c52a49c2b7507d7cd2 (patch) | |
tree | d7cfe8e0ab6452ad1ac78d2fd9450438969a9391 | |
parent | de77bf7a8a9b1600f449ba42fa0da211c712fef0 (diff) | |
download | meta-xilinx-4f617750e838f995b7bb09c52a49c2b7507d7cd2.tar.gz |
newlib: export CC_FOR_TARGET as CC
Newlibs Makefiles use a variable CC_FOR_TARGET to build
libraries for the TARGET machine (as opposed to
CC_FOR_BUILD).
We pass CC on our compile function, which is normally
use to build, although in this case, the configure
script is trimming CC and using simply gcc for the target
machine, basically taking out the TUNE variables we pass
in CC as well, such as march, mfloat-abi and such.
This causes errors when building applications since
CC will try to use hard floating point for example
whereas the libc.a from newlib will contain libraries
built with the defaults which could be soft floating
point for example.
e.g.:
$ ${CC} a.c
real-ld: error: a.out uses VFP register arguments,
/usr/lib/libg.a(lib_a-stdio.o) does not.
Analizing the object files we can see that one of them
uses soft (library) and the other one uses hard
floating point (program):
$ readelf -A a.out | grep VFP
Tag_ABI_VFP_args: VFP registers
$ readelf -A usr/lib/libc.a | grep VFP
Hence why the linker complains.
Pass CC_FOR_TARGET with the contents of CC to override
the trimming from the configure script and build newlib
with the correct tune.
Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
-rw-r--r-- | meta-xilinx-standalone/recipes-standalone/newlib/newlib_3.1.0.bbappend | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/meta-xilinx-standalone/recipes-standalone/newlib/newlib_3.1.0.bbappend b/meta-xilinx-standalone/recipes-standalone/newlib/newlib_3.1.0.bbappend index e5249ab0..2b015c90 100644 --- a/meta-xilinx-standalone/recipes-standalone/newlib/newlib_3.1.0.bbappend +++ b/meta-xilinx-standalone/recipes-standalone/newlib/newlib_3.1.0.bbappend | |||
@@ -2,3 +2,7 @@ do_configure_prepend_microblaze() { | |||
2 | # hack for microblaze, which needs xilinx.ld to literally do any linking (its hard coded in its LINK_SPEC) | 2 | # hack for microblaze, which needs xilinx.ld to literally do any linking (its hard coded in its LINK_SPEC) |
3 | export CC="${CC} -L${S}/libgloss/microblaze" | 3 | export CC="${CC} -L${S}/libgloss/microblaze" |
4 | } | 4 | } |
5 | |||
6 | do_configure_prepend(){ | ||
7 | export CC_FOR_TARGET="${CC}" | ||
8 | } | ||