insane.bbclass: use HOST_ARCH to check for 32-bit symbols
PATCH 1/1 insane.bbclass: use HOST_ARCH to check for 32-bit symbols
Using OVERRIDES in the check generates false positives in some scenarios, for example when building binaries for an SDK supposed to run on a 64-bit host. Therefore, it is more correct to use HOST_ARCH for the check instead.
$ bitbake -c do_package_qa gcc-cross-canadian-arm
(...)
/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'localtime'
/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'fcntl'
/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'lstat'
/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'wait4'
/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'gettimeofday'
/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'stat'
/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'fstat'
/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'ioctl'
/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'time'
/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'gmtime'
Suppress with INSANE_SKIP = "32bit-time"--- meta/classes-global/insane.bbclass | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
meta/classes-global/insane.bbclass +1 -2
@@ -515,8 +515,7 @@ def check_32bit_symbols(path, packagename, d, elf, messages): Check that ELF files do not use any 32 bit time APIs from glibc. """ thirtytwo_bit_time_archs = {'arm','armeb','mipsarcho32','powerpc','x86'} - overrides = set(d.getVar('OVERRIDES').split(':')) - if not (thirtytwo_bit_time_archs & overrides): + if d.getVar('HOST_ARCH') not in thirtytwo_bit_time_archs: return import re
base-commit: 50f78cb9de68cd4317f34321dfdb06d72ce5d3c6
Signature · 1 line
2.45.1
Quoted 29 lines · Emil Kronborg via lists.openembedded.org
Using OVERRIDES in the check generates false positives in some scenarios, for example when building binaries for an SDK supposed to run on a 64-bit host. Therefore, it is more correct to use
HOST_ARCHfor the check instead.$ bitbake -c do_package_qa gcc-cross-canadian-arm (...) /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'localtime' /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'fcntl' /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'lstat' /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'wait4' /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'gettimeofday' /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'stat' /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'fstat' /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'ioctl' /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'time' /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ uses 32-bit api 'gmtime' Suppress with INSANE_SKIP = "32bit-time"Signed-off-by Emil Kronborg <[email protected]>---
meta/classes-global/insane.bbclass | 3 +--1 file changed, 1 insertion(+), 2 deletions(-)meta/classes-global/insane.bbclass +0
-0@@ -515,8 +515,7 @@ def check_32bit_symbols(path, packagename, d, elf, messages):
Quoted 8 lines
Check that ELF files do not use any 32 bit time APIs from glibc. """
thirtytwo_bit_time_archs= {'arm','armeb','mipsarcho32','powerpc','x86'} - overrides = set(d.getVar('OVERRIDES').split(':'))
- if not (thirtytwo_bit_time_archs& overrides):
+ ifd.getVar('HOST_ARCH')not inthirtytwo_bit_time_archs:
return
This is not correct, e.g. HOST_ARCH does not always equal "x86" for 32 bit x86 builds.
$ MACHINE=qemux86 bitbake -e | grep ^OVERRIDES= -C 2
# pre-expansion value:
# "${TARGET_OS}:${TRANSLATED_TARGET_ARCH}:pn-${PN}:layer-${FILE_LAYERNAME}:${MACHINEOVERRIDES}:${DISTROOVERRIDES}:${CLASSOVERRIDE}${LIBCOVERRIDE}:forcevariable"
OVERRIDES="linux:i686:pn-defaultpkgname:layer-config:x86:qemuall:qemux86:poky:poky-altcfg:class-target:libc-glibc:forcevariable"i.e. the x86 comes from MACHINEOVERRIDES.
Cheers,
Richard
Quoted 9 lines · Richard Purdie
This is not correct, e.g.
HOST_ARCHdoes not always equal "x86" for 32 bit x86 builds.$ MACHINE=qemux86 bitbake -e | grep ^OVERRIDES= -C 2 # pre-expansion value: # "${TARGET_OS}:${TRANSLATED_TARGET_ARCH}:pn-${PN}:layer-${FILE_LAYERNAME}:${MACHINEOVERRIDES}:${DISTROOVERRIDES}:${CLASSOVERRIDE}${LIBCOVERRIDE}:forcevariable" OVERRIDES="linux:i686:pn-defaultpkgname:layer-config:x86:qemuall:qemux86:poky:poky-altcfg:class-target:libc-glibc:forcevariable"i.e. the x86 comes from MACHINEOVERRIDES.
There is obviously a problem when building binaries for an SDK and using OVERRIDES for the check. To me, HOST_ARCH looks most correct, but if it misses some cases, it should not be used as a one-to-one replacement for OVERRIDES. Is there some proper way in BitBake to catch all 32-bit architectures? If not, would adding i686, and potentially other missing names, to the list of 32-bit time architectures, i.e thirtytwo_bit_time_archs, be feasible?
Signature · 1 line
Emil Kronborg
Quoted 7 lines · Emil Kronborg via lists.openembedded.org
There is obviously a problem when building binaries for an SDK and using OVERRIDES for the check. To me,
HOST_ARCHlooks most correct, but if it misses some cases, it should not be used as a one-to-one replacement for OVERRIDES. Is there some proper way in BitBake to catch all 32-bit architectures? If not, would adding i686, and potentially other missing names, to the list of 32-bit time architectures, i.ethirtytwo_bit_time_archs, be feasible?
I vaguely remember that at some point I ran 'bitbake -e recipe' against qemux86 machine to study that question, and looked through all related variables, and couldn't find anything better. But you're welcome to try that as well.
Alex
Quoted 4 lines · Alexander Kanavin
I vaguely remember that at some point I ran 'bitbake -e recipe' against qemux86 machine to study that question, and looked through all related variables, and couldn't find anything better. But you're welcome to try that as well.
For my specific example, I still believe it is more accurate to use HOST_ARCH and add "i686" to thirtytwo_bit_time_archs. This setup does not generate false positives and also works for qemux86. However, it will not necessarily work for other cases. To make it more general, I think some of the architectures from meta/lib/oe/elf.py can be added to thirtytwo_bit_time_archs. When comparing this with elf.py, I noticed some inconsistency. For example, both "arm" and "armb" are defined, while only "x86" is defined. Shouldn't the latter substituted with "i386", "i486", "i586" and "i686"? Also, shouldn't "mipsarcho32" correspond to the entries in elf.py? I'm unsure which ones exactly though.
Signature · 1 line
Emil Kronborg