All of lore.kernel.org
 help / color / mirror / Atom feed
* Build error with clang 4.0
@ 2016-12-27 15:10 Paul Menzel
  2016-12-30 15:44 ` Andrei Borzenkov
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Menzel @ 2016-12-27 15:10 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 1482 bytes --]

Dear GRUB folks,


Using Clang 4.0 the build fails with the error below.

```
$ sudo apt install clang-4.0 # Debian Sid/unstable
$ clang-4.0 --version
clang version 4.0.0-svn286225-1 (trunk)
Target: i686-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ git log --oneline -1
ce95549cc efi: properly terminate filepath with NULL in chainloader
$ ./autoconf.sh
$ CC=clang-4.0 ../grub/configure --with-platform=coreboot --enable-boot-time
$ make -j
[…]
../grub/grub-core/fs/hfs.c:699:10: error: taking address of packed member 'catalog_recs' of class or structure 'grub_hfs_sblock' may result in an unaligned pointer
      value [-Werror,-Waddress-of-packed-member]
                                        ? (&data->sblock.catalog_recs)
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~
../grub/grub-core/fs/hfs.c:700:10: error: taking address of packed member 'extent_recs' of class or structure 'grub_hfs_sblock' may result in an unaligned pointer
      value [-Werror,-Waddress-of-packed-member]
                                        : (&data->sblock.extent_recs));
                                            ^~~~~~~~~~~~~~~~~~~~~~~~
[…]
```

The build succeeds using gcc (Debian 6.2.1-7) 6.2.1 20161215, so I am
unsure if this is a Clang issue.


Kind regards,

Paul

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Build error with clang 4.0
  2016-12-27 15:10 Build error with clang 4.0 Paul Menzel
@ 2016-12-30 15:44 ` Andrei Borzenkov
  2017-01-06 22:34   ` [solved] " Paul Menzel
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Borzenkov @ 2016-12-30 15:44 UTC (permalink / raw)
  To: grub-devel


[-- Attachment #1.1: Type: text/plain, Size: 2293 bytes --]

27.12.2016 18:10, Paul Menzel пишет:
> Dear GRUB folks,
> 
> 
> Using Clang 4.0 the build fails with the error below.
> 
> ```
> $ sudo apt install clang-4.0 # Debian Sid/unstable
> $ clang-4.0 --version
> clang version 4.0.0-svn286225-1 (trunk)
> Target: i686-pc-linux-gnu
> Thread model: posix
> InstalledDir: /usr/bin
> $ git log --oneline -1
> ce95549cc efi: properly terminate filepath with NULL in chainloader
> $ ./autoconf.sh
> $ CC=clang-4.0 ../grub/configure --with-platform=coreboot --enable-boot-time
> $ make -j
> […]
> ../grub/grub-core/fs/hfs.c:699:10: error: taking address of packed member 'catalog_recs' of class or structure 'grub_hfs_sblock' may result in an unaligned pointer
>       value [-Werror,-Waddress-of-packed-member]
>                                         ? (&data->sblock.catalog_recs)
>                                             ^~~~~~~~~~~~~~~~~~~~~~~~~
> ../grub/grub-core/fs/hfs.c:700:10: error: taking address of packed member 'extent_recs' of class or structure 'grub_hfs_sblock' may result in an unaligned pointer
>       value [-Werror,-Waddress-of-packed-member]
>                                         : (&data->sblock.extent_recs));
>                                             ^~~~~~~~~~~~~~~~~~~~~~~~
> […]
> ```
> 
> The build succeeds using gcc (Debian 6.2.1-7) 6.2.1 20161215, so I am
> unsure if this is a Clang issue.
> 

I remember having seen it with LLVM/clang development snapshot before
but got distracted. But currently I cannot reproduce it using LLVM/clang
git as of yesterday, even if I explicitly add -Waddress-of-packed-member
to compile options. May be I miss some steps.

Regarding issue itself - we should not have alignment problem here, at
least on known platforms. Structure elements are properly aligned inside
of structure and structure itself is at the beginning of malloc returned
memory.

I was about to change prototype to (void *) then as I mentioned forgot
about it (or, better, issue did not happen in released clang so I did
not want to add workarounds for development snapshot).

It would be helpful if you could check when issue disappeared (if it
did). Unfortunately, full LLVM/clang build takes half a day on my system
and tears HDD apart :(


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [solved] Build error with clang 4.0
  2016-12-30 15:44 ` Andrei Borzenkov
@ 2017-01-06 22:34   ` Paul Menzel
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Menzel @ 2017-01-06 22:34 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 2773 bytes --]

Dear Andrei,


Am Freitag, den 30.12.2016, 18:44 +0300 schrieb Andrei Borzenkov:
> 27.12.2016 18:10, Paul Menzel пишет:

> > Using Clang 4.0 the build fails with the error below.
> > 
> > ```
> > $ sudo apt install clang-4.0 # Debian Sid/unstable
> > $ clang-4.0 --version
> > clang version 4.0.0-svn286225-1 (trunk)
> > Target: i686-pc-linux-gnu
> > Thread model: posix
> > InstalledDir: /usr/bin
> > $ git log --oneline -1
> > ce95549cc efi: properly terminate filepath with NULL in chainloader
> > $ ./autoconf.sh
> > $ CC=clang-4.0 ../grub/configure --with-platform=coreboot --enable-boot-time
> > $ make -j
> > […]
> > ../grub/grub-core/fs/hfs.c:699:10: error: taking address of packed member 'catalog_recs' of class or structure 'grub_hfs_sblock' may result in an unaligned pointer
> >       value [-Werror,-Waddress-of-packed-member]
> >                                         ? (&data->sblock.catalog_recs)
> >                                             ^~~~~~~~~~~~~~~~~~~~~~~~~
> > ../grub/grub-core/fs/hfs.c:700:10: error: taking address of packed member 'extent_recs' of class or structure 'grub_hfs_sblock' may result in an unaligned pointer
> >       value [-Werror,-Waddress-of-packed-member]
> >                                         : (&data->sblock.extent_recs));
> >                                             ^~~~~~~~~~~~~~~~~~~~~~~~
> > […]
> > ```
> > 
> > The build succeeds using gcc (Debian 6.2.1-7) 6.2.1 20161215, so I am
> > unsure if this is a Clang issue.
> > 
> 
> I remember having seen it with LLVM/clang development snapshot before
> but got distracted. But currently I cannot reproduce it using LLVM/clang
> git as of yesterday, even if I explicitly add -Waddress-of-packed-member
> to compile options. May be I miss some steps.
> 
> Regarding issue itself - we should not have alignment problem here, at
> least on known platforms. Structure elements are properly aligned inside
> of structure and structure itself is at the beginning of malloc returned
> memory.
> 
> I was about to change prototype to (void *) then as I mentioned forgot
> about it (or, better, issue did not happen in released clang so I did
> not want to add workarounds for development snapshot).
> 
> It would be helpful if you could check when issue disappeared (if it
> did). Unfortunately, full LLVM/clang build takes half a day on my system
> and tears HDD apart :(

It seems to have been a LLVM/clang issue. With the version below, from
around January 1st or 2nd I believe, everything builds fine.

```
$ clang-4.0 --version
clang version 4.0.0-svn290810-1 (trunk)
Target: i686-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```

Sorry for the noise.


Thanks,

Paul

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-06 22:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-27 15:10 Build error with clang 4.0 Paul Menzel
2016-12-30 15:44 ` Andrei Borzenkov
2017-01-06 22:34   ` [solved] " Paul Menzel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.