[U-Boot] [PATCH v3 0/8] add clang support for some ARM boards

Jeroen Hofstee jeroen at myspectrum.nl
Thu Sep 11 22:12:32 CEST 2014


Hello Albert,

On 11-09-14 15:31, Albert ARIBAUD wrote:
>> Thanks, tested building rpi_b, it works now.
>>
>> The, tested on versatileqemu out of curiosity and got the following
>> results:
>>
>> 1.
>>
>> clang warns about Unused static functions in common/console.c, namely
>> console_printdevs and console_doenv (1). Why gcc does not flag this?
>> We have -Wall set which is supposed to imply -Wunused-functions.
>> It is a gcc feature, see [1]: "Warn whenever a static function is
>> declared but not defined or a _non-inline static function_ is unused.
>> This warning is enabled by -Wall."
> Ok, I'll assume there is some logic in there, but then, clang does not
> follow that logic -- so which one is the 'good' one? Or maybe that's
> the same as the second issue, where...

well I don't know the details, but the compiler should not emit a
warning if the static inline came from a header file, perhaps that
is motivation behind it. Anyway I have a branch with 60 patches
or so fixing warnings, don't bother too much about them for the
time being.

>>> 2.
>>>
>>> clang errors on arch/arm/lib/cache.c:28 for this:
>>> asm("0: mrc p15, 0, r15, c7, c10, 3\n\t" "bne 0b\n" : : : "memory");
>>> and that is a clang mistake, as for ARM926EJS r15 is a valid (albeit
>>> quite special semantically) Rd for Test and Clean DCache, see page 2-24.
>>>
>> This is the integrated-as complaining (the README tells you to disable
>> it for the moment). The clang folks push UAL hard, up to a point we need
>> to think about minimum gcc version etc. To avoid that, I just left out
>> such changes and just use gas instead, at least for the time being.
>> Below are some changes to compile versatileqemu with llvm integrated-as
>> and gcc/gas. No idea if it actually boots though.
>>
[..]

>> ~       "mrc p15, 0, r15, c7, c14, 3\n"
>> +       "mrc p15, 0, apsr_nzcv, c7, c14, 3\n"
> Is this is a hack to set the Rd field of the mrc instruction to a value
> equal to what "r15" would have given, but fooling clang by using an
> unrelated and, in this context, meaningless, symbol instead of "r15"?
>

Nope, it is UAL syntax, binutils agrees:

 > arm-linux-gnueabi-objdump -S u-boot

flush_dcache:
         mrc     p15, 0, r15, c7, c10, 3
    10320:       ee17ff7a        mrc     15, 0, APSR_nzcv, cr7, cr10, {3}


Clang is just pushing it a bit harder. I have a branch for that too,
but as said, I will let it bit-rot for a while, since that would require
about minimal gcc versions and other boring stuff.

Regards,
Jeroen




More information about the U-Boot mailing list