mbox series

[00/13] Support building with clang

Message ID 20180502083753.25090-1-joel@jms.id.au
Headers show
Series Support building with clang | expand

Message

Joel Stanley May 2, 2018, 8:37 a.m. UTC
Hello Skibooters!

This series contains cleanups and modifications that are required to
build skiboot with clang.

If you want to try it out:

 $ sudo apt-get install clang
 $ make CC=clang

I've done all of my testing with clang-7 (trunk). Clang 6 works fine
too, but earlier versions have a number of issues.

Most of the patches could be considered cleanup or have no impact on GCC
builds.

The last three that change the make file are quite clang specific, but
again have no impact on normal building of skiboot.

Please test, and if they look good, merge! I have plans down the track
for using clang to improve our code quality.

Cheers,

Joel

Joel Stanley (13):
  asm: Fix up assembly for clang
  cpu.h: Use this_cpu through accessor
  cpu.h: implement this_cpu for clang
  libflash/ecc: disable asm version for clang
  processor.h: implement sndmsg instructions
  Makefile: Use LD to link the final binary
  Fix asm-offsets generation
  pci-quirk: Fix initiliser warning
  imc: Remove extra parentheses in test
  fsp: Fix msg vaargs usage
  Makefile: Put some ppc options behind try-cflag tests
  Makefile: Add additional flags when using clang
  Makefile: Disable warnings to make clang happy

 Makefile.main       | 44 ++++++++++++++++++++++++++++++++++++++------
 asm/head.S          |  4 ++--
 core/pci-quirk.c    |  2 +-
 hw/fsp/fsp.c        |  4 ++--
 hw/imc.c            |  2 +-
 include/cpu.h       | 24 +++++++++++++++++++++++-
 include/fsp.h       |  4 ++--
 include/processor.h | 33 ++++++++++++++++++++++++++++++---
 libflash/ecc.c      |  2 +-
 make_offsets.sh     |  2 +-
 10 files changed, 101 insertions(+), 20 deletions(-)

Comments

Balbir Singh May 2, 2018, 9:05 a.m. UTC | #1
On Wed, 2018-05-02 at 18:07 +0930, Joel Stanley wrote:
> Hello Skibooters!
> 
> This series contains cleanups and modifications that are required to
> build skiboot with clang.
> 
> If you want to try it out:
> 
>  $ sudo apt-get install clang
>  $ make CC=clang
> 
> I've done all of my testing with clang-7 (trunk). Clang 6 works fine
> too, but earlier versions have a number of issues.
> 
> Most of the patches could be considered cleanup or have no impact on GCC
> builds.
> 
> The last three that change the make file are quite clang specific, but
> again have no impact on normal building of skiboot.
> 
> Please test, and if they look good, merge! I have plans down the track
> for using clang to improve our code quality.
> 
> Cheers,
> 
> Joel
> 
> Joel Stanley (13):
>   asm: Fix up assembly for clang
>   cpu.h: Use this_cpu through accessor
>   cpu.h: implement this_cpu for clang
>   libflash/ecc: disable asm version for clang
>   processor.h: implement sndmsg instructions
>   Makefile: Use LD to link the final binary
>   Fix asm-offsets generation
>   pci-quirk: Fix initiliser warning
>   imc: Remove extra parentheses in test
>   fsp: Fix msg vaargs usage
>   Makefile: Put some ppc options behind try-cflag tests
>   Makefile: Add additional flags when using clang
>   Makefile: Disable warnings to make clang happy
>

These patches don't seem to be in order, in the sense that I'd expect
the first patch to fix the Makefile for -ffixed-reg and -m* and -Wl.
Then fix the files that don't compile, etc

Balbir Singh.
Joel Stanley May 3, 2018, 3:04 a.m. UTC | #2
On 2 May 2018 at 18:35, Balbir Singh <bsingharora@gmail.com> wrote:
> On Wed, 2018-05-02 at 18:07 +0930, Joel Stanley wrote:
>> Hello Skibooters!
>>
>> This series contains cleanups and modifications that are required to
>> build skiboot with clang.
>>
>> If you want to try it out:
>>
>>  $ sudo apt-get install clang
>>  $ make CC=clang
>>
>> I've done all of my testing with clang-7 (trunk). Clang 6 works fine
>> too, but earlier versions have a number of issues.
>>
>> Most of the patches could be considered cleanup or have no impact on GCC
>> builds.
>>
>> The last three that change the make file are quite clang specific, but
>> again have no impact on normal building of skiboot.
>>
>> Please test, and if they look good, merge! I have plans down the track
>> for using clang to improve our code quality.
>>
>> Cheers,
>>
>> Joel
>>
>> Joel Stanley (13):
>>   asm: Fix up assembly for clang
>>   cpu.h: Use this_cpu through accessor
>>   cpu.h: implement this_cpu for clang
>>   libflash/ecc: disable asm version for clang
>>   processor.h: implement sndmsg instructions
>>   Makefile: Use LD to link the final binary
>>   Fix asm-offsets generation
>>   pci-quirk: Fix initiliser warning
>>   imc: Remove extra parentheses in test
>>   fsp: Fix msg vaargs usage
>>   Makefile: Put some ppc options behind try-cflag tests
>>   Makefile: Add additional flags when using clang
>>   Makefile: Disable warnings to make clang happy
>>
>
> These patches don't seem to be in order, in the sense that I'd expect
> the first patch to fix the Makefile for -ffixed-reg and -m* and -Wl.
> Then fix the files that don't compile, etc

Yeah I had it that way, but thought this would make more sense. I'll
think a bit harder before posting a second version.

Cheers,

Joel
Stewart Smith May 3, 2018, 9:01 a.m. UTC | #3
Joel Stanley <joel@jms.id.au> writes:
> Please test, and if they look good, merge! I have plans down the track
> for using clang to improve our code quality.

I managed to get 'scan-build --use-cc=clang make CC=clang' get me
something sensible! I think it even found what could technically be a
bug or two.