Skip to content

Fix building with clang

Darren Kenny grub-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 1 replyIn review
  2. v12 patches 0 repliesSuperseded

Changes in v2 from the cover letter

--------
- Update with changes to INSTALL and safemath.h after testing various clang versions from 3.8 and up.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3gnulib: Provide abort() implementation for gnulibconfig.h.in grub-core/kern/compiler-rt.c grub-core/kern/misc.c +2 more+8 -240 replies
2/3configure: Fix building with clangconfigure.ac+4 -00 replies
3/3build: Update to reflect minimum clang version 8.0INSTALL include/grub/safemath.h+4 -40 replies

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDaniel Kiper
SeriesR-b
1/3
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/3] Fix building with clang

The abiltiy to build with clang was broken in the last release after the upgrade of gnulib, but it would also appear to have been broken too with versions of clang prior to 8.0.0.

There were two main issues:

- The use of __builtin_trap in the abort() macro.

This builtin doesn't exist for clang builds

After some discussion between Daniel and Vladimir, it was requested that I should revert some past changes in this area, and re-introduce the use of grub_abort().

- The is some use of variable length arrays (vla) in gnulib's code, and when an attempt was made to resolve this in gnulib itself, I was informed that we shouldn't be building gnulib with -Werror.

Rather than totally disabling -Werror, it seemed better to just limit it for the specific case that is causing problems, i.e. vla.

- Attempts to build clang with versions prior to 8.0.0 are also failing due to the use of the previously introduced safematch function usage. So we're also bumping the minimum version of clang in the INSTALL file and safemath.h where the test is done for the requisite version.

Thanks,

Darren.

v1 -> v2
--------
- Update with changes to INSTALL and safemath.h after testing various clang versions from 3.8 and up.

Darren Kenny (3):
gnulib: Provide abort() implementation for gnulib
configure: Fix building with clang
build: Update to reflect minimum clang version 8.0

 INSTALL                           |  2 +-
 config.h.in                       | 10 ----------
 configure.ac                      |  4 ++++
 grub-core/kern/compiler-rt.c      |  9 ---------
 grub-core/kern/misc.c             |  2 +-
 grub-core/lib/posix_wrap/stdlib.h |  6 ++++++
 include/grub/misc.h               |  5 +----
 include/grub/safemath.h           |  6 +++---
 8 files changed, 16 insertions(+), 28 deletions(-)
Signature · 1 line
2.31.1