[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to distinguish armel and armhf at runtime?



On Sun, Sep 24, 2017 at 2:42 AM, Uwe Kleine-König wrote:
> On Sat, Sep 23, 2017 at 02:08:28AM +0100, Steve McIntyre wrote:
>> On Fri, Sep 22, 2017 at 09:57:02PM +0200, Uwe Kleine-König wrote:
>> >Hello,
>> >
>> >for the package sparse I have to distinguish armel and armhf. The reason
>> >is that sparse parses system headers and so has to know which cpp
>> >symbols to define. Usually it uses uname -m to distinguish platforms but
>> >that isn't suitable to tell armel and armhf apart.
>> >
>> >For armhf I need to define __ARM_PCS_VFP but that must be absent on armel.
>>
>> Right, that makes sense.
>>
>> >For upstreaming a fix it would be great if the test would not be Debian
>> >specific.
>>
>> That's likely to be difficult - it's perfectly possible to have
>> headers etc. for both on a single system with multi-arch (for
>> example). It's an ABI choice, not a hardware difference.
>>
>> What are you trying to work this out for? Package build time?
>
> No, it's for run time. The target is sparse which can parse C and to be
> able to handle system includes it needs the right cpp variables defined.
>
> Currently the test suite for sparse makes the package FTBFS on armhf:
>
>         env CHECK=./sparse ./cgcc -no-compile memops.c
>         /usr/include/arm-linux-gnueabihf/gnu/stubs.h:7:12: error: unable to open 'gnu/stubs-soft.h'
>
> The scripts that needs adaption is
>
>         http://sources.debian.net/src/sparse/0.5.0-4/cgcc/#L224

That script calls the real compiler to find out various things, so it
sounds like you just need to make it find out what the compiler
include path is:

This appears to be the best option since it works for clang and gcc:

cc -E -Wp,-v - < /dev/null

I guess you can parse the output fine in perl but here is a sed script
to strip out the cruft in the output:

sed -n 's/^ //;/^#include <\.\.\.> search starts here:$/,/^End of
search list\.$/{//!p}'

Info found via these pages:

https://stackoverflow.com/questions/17939930/finding-out-what-the-gcc-include-path-is
https://gcc.gnu.org/ml/gcc-help/2007-09/msg00206.html
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4917

-- 
bye,
pabs

https://wiki.debian.org/PaulWise


Reply to: