[OE-core] [PATCH 2/5] gcc-runtime: enable asan and tsan

Jonathan Liu net147 at gmail.com
Thu Sep 4 15:37:39 UTC 2014


On 5/09/2014 1:28 AM, Dan McGregor wrote:
> On 4 September 2014 08:33, Jonathan Liu <net147 at gmail.com> wrote:
>> On 30/08/2014 7:15 AM, Dan McGregor wrote:
>>> From: Dan McGregor <dan.mcgregor at usask.ca>
>>>
>>> ASan and TSan are useful debugging tools, enable them on the
>>> target and add the packages to packagegroup-core-sdk.
>>>
>>> Signed-off-by: Dan McGregor <dan.mcgregor at usask.ca>
>>> ---
>>>    .../recipes-core/packagegroups/packagegroup-core-sdk.bb |  4 +++-
>>>    meta/recipes-devtools/gcc/gcc-runtime.inc               | 17
>>> +++++++++++++++++
>>>    2 files changed, 20 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
>>> b/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
>>> index a544bbd..378336e 100644
>>> --- a/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
>>> +++ b/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
>>> @@ -28,7 +28,9 @@ RDEPENDS_packagegroup-core-sdk = "\
>>>
>>>    RRECOMMENDS_packagegroup-core-sdk = "\
>>>        libgomp \
>>> -    libgomp-dev"
>>> +    libgomp-dev \
>>> +    libsanitizer \
>>> +    libsanitizer-dev"
>>>
>>>    #python generate_sdk_pkgs () {
>>>    #    poky_pkgs = read_pkgdata('packagegroup-core', d)['PACKAGES']
>>> diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc
>>> b/meta/recipes-devtools/gcc/gcc-runtime.inc
>>> index 7ce84f1..109f8dd 100644
>>> --- a/meta/recipes-devtools/gcc/gcc-runtime.inc
>>> +++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
>>> @@ -11,6 +11,8 @@ EXTRA_OECONF_PATHS = "\
>>>    EXTRA_OECONF_append_linuxstdbase = " --enable-clocale=gnu"
>>>
>>>    RUNTIMETARGET = "libssp libstdc++-v3 libgomp libatomic"
>>> +RUNTIMETARGET_append_arm = " libsanitizer"
>>> +RUNTIMETARGET_append_x86 = " libsanitizer"
>>>    #  ?
>>>    # libiberty
>>>    # libmudflap
>>> @@ -88,6 +90,9 @@ PACKAGES = "\
>>>        libatomic \
>>>        libatomic-dev \
>>>        libatomic-staticdev \
>>> +    libsanitizer \
>>> +    libsanitizer-dev \
>>> +    libsanitizer-staticdev \
>>>    "
>>>    # The base package doesn't exist, so we clear the recommends.
>>>    RRECOMMENDS_${PN}-dbg = ""
>>> @@ -171,6 +176,18 @@ FILES_libatomic-dev = "\
>>>    "
>>>    FILES_libatomic-staticdev = "${libdir}/libatomic.a"
>>>
>>> +FILES_libsanitizer = "${libdir}/libasan.so.* ${libdir}/libubsan.so.*"
>>> +FILES_libsanitizer-dev = " \
>>> +  ${libdir}/libsanitizer.spec \
>>> +  ${libdir}/libasan_preinit.o \
>>> +  ${libdir}/libasan.so \
>>> +  ${libdir}/libubsan.so \
>>> +  ${libdir}/libasan.la \
>>> +  ${libdir}/libubsan.la"
>>> +FILES_libsanitizer-staticdev = " \
>>> +  ${libdir}/libasan.a \
>>> +  ${libdir}/libubsan.a"
>>> +
>>>    do_package_write_ipk[depends] +=
>>> "virtual/${MLPREFIX}libc:do_packagedata"
>>>    do_package_write_deb[depends] +=
>>> "virtual/${MLPREFIX}libc:do_packagedata"
>>>    do_package_write_rpm[depends] +=
>>> "virtual/${MLPREFIX}libc:do_packagedata"
>> I get the following error during do_install for gcc-runtime on Arch Linux
>> x86_64 host when it is linking libasan:
>> /usr/lib/libpthread.a: error adding symbols: File format not recognized
>>
> What machine are you building for? Or is this the SDK that's failing?
> This error looks like it's trying to link against the host's pthread library.
>
> I tested this on Fedora 20 x86_64.
I am building for ARMv7 device. I tested your v3 "gcc-runtime: enable 
sanitizer" patch as well with the same result (bitbake gcc-runtime).
It is same issue as posted on opemembedded-devel some months ago: 
http://permalink.gmane.org/gmane.comp.handhelds.openembedded/63689
When running do_install for gcc-runtime, it relinks libasan and has 
-L/usr/lib in the command line when linking libasan.so because 
libasan.la contains:
libdir='/usr/lib'.

The log.do_install file indicates:
warning: library search path "/usr/lib" is unsafe for cross-compilation

On your host system, do you have /usr/lib/libpthread.a?
Does your log.do_install indicate the that libasan.so is linked with 
-L/usr/lib search path with "warning: library search path "/usr/lib" is 
unsafe for cross-compilation"?

Regards,
Jonathan



More information about the Openembedded-core mailing list