Re: cgcc and -Dx86_64

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

 



On 12/21/2016 12:13 PM, Linus Torvalds wrote:
> On Wed, Dec 21, 2016 at 8:07 AM, Joe Lawrence <joe.lawrence@xxxxxxxxxx> wrote:
>>
>> I was trying to run sparse against the upstream kpatch project and ran
>> into problems with an include file that defined an "x86_64" variable:
> 
> Yeah,. that's bogus. It should be removed. It goes back to the
> original x86-64 specific cgcc patch from 2007 (commit 0fcbcbf:
> "Implement x86-64 support in cgcc").
> 
> It may be that old versions of gcc did the same, who knows. They
> definitely don't any more, I checked:
> 
>   $ gcc -dM -E - < /dev/null | grep -v 'define __'
> 
>   #define _STDC_PREDEF_H 1
>   #define unix 1
>   #define linux 1
>   #define _LP64 1
> 
> and so gcc itself definitely doesn't do the x86_64 thing (it does
> pre-define versions with double underscores before and after):
> 
>   $ gcc -dM -E - < /dev/null | grep x86
>   #define __x86_64 1
>   #define __x86_64__ 1
> 
>> I can avoid this by renaming the structure member to something like
>> "foo_x86_64".  I believe the problem stems from cgcc passing "-Dx86_64"
>> to gcc... sparse later gets confused as there is now a preprocessor
>> variable defined with the same name.
> 
> You shouldn't need that.
> 
>> We could s/x86_64/something_else/g across the whole project to avoid
>> this glitch, but was wondering if there was a better way.
> 
> The fix it so just remove x86_64 from cgcc. It already does define the
> underscored versions.
> 
> Same for the other architectures, for that matter. Obvios trivial (and
> totally untested) patch attached.
> 

Thanks, Linus!

The patch worked well for me, so consider this tested (on x86_64 at least).

-- Joe

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux