Bug 238654 - sysutils/shim: Unbreak build with GCC 9
Summary: sysutils/shim: Unbreak build with GCC 9
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Vinícius Zavam
URL: https://github.com/rhboot/shim/issues...
Keywords: needs-qa, patch
Depends on:
Blocks: 238330
  Show dependency treegraph
 
Reported: 2019-06-17 11:18 UTC by Tobias Kortkamp
Modified: 2019-06-25 13:35 UTC (History)
2 users (show)

See Also:
egypcio: maintainer-feedback+


Attachments
shim.diff (2.77 KB, patch)
2019-06-17 11:18 UTC, Tobias Kortkamp
tobik: maintainer-approval? (egypcio)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Kortkamp freebsd_committer 2019-06-17 11:18:52 UTC
Created attachment 205172 [details]
shim.diff

shim fails to build with GCC 9:

gcc9 -std=gnu99 -ggdb -O0 -fno-stack-protector -fno-strict-aliasing -fpic -fshort-wchar -Wall -Wsign-compare -Werror -fno-builtin -Werror=sign-compare -ffreestanding -I/usr/local/lib/gcc9/gcc/x86_64-portbld-freebsd12.0/9.1.0/include "-DDEFAULT_LOADER=L\"\\\\grub.efi\"" "-DDEFAULT_LOADER_CHAR=\"\\\\grub.efi\"" -nostdinc -ICryptlib -ICryptlib/Include -I/usr/local/include/efi -I/usr/local/include/efi/x86_64 -I/usr/local/include/efi/protocol -I/wrkdirs/usr/ports/sysutils/shim/work/shim-0.9/include -I/usr/include -mno-mmx -mno-sse -mno-red-zone -nostdinc -maccumulate-outgoing-args -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI "-DEFI_ARCH=L\"x64\"" "-DDEBUGDIR=L\"/usr/lib/debug/usr/share/shim/x64-0.9""/\""   -c -o MokManager.o MokManager.c
MokManager.c: In function 'write_back_mok_list':
MokManager.c:1040:19: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
 1040 |   if (CompareGuid(&(list[i].Type), &CertType) == 0)
      |                   ^~~~~~~~~~~~~~~
MokManager.c:1062:19: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
 1062 |   if (CompareGuid(&(list[i].Type), &CertType) == 0) {
      |                   ^~~~~~~~~~~~~~~
MokManager.c: In function 'delete_cert':
MokManager.c:1103:19: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
 1103 |   if (CompareGuid(&(mok[i].Type), &CertType) != 0)
      |                   ^~~~~~~~~~~~~~
MokManager.c: In function 'delete_hash_in_list':
MokManager.c:1154:20: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
 1154 |   if ((CompareGuid(&(mok[i].Type), &Type) != 0) ||
      |                    ^~~~~~~~~~~~~~
MokManager.c: In function 'delete_keys':
MokManager.c:1325:19: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
 1325 |   if (CompareGuid(&(del_key[i].Type), &CertType) == 0) {
      |                   ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

http://package18.nyi.freebsd.org/data/120amd64-default-PR238330/2019-06-09_20h26m27s/logs/errors/shim-0.9_2.log

This has been reported at [1], which leads to a patch [2].  I have
adapted it to the version in port which fixes the build but if
runtime is fine too I do not know.  Can you take a look?

[1] https://github.com/rhboot/shim/issues/161
[2] https://github.com/rhboot/shim/pull/170
Comment 1 Vinícius Zavam freebsd_committer 2019-06-18 09:02:06 UTC
I am on it; building/testing. thanks
Comment 2 commit-hook freebsd_committer 2019-06-25 13:32:55 UTC
A commit references this bug:

Author: egypcio
Date: Tue Jun 25 13:32:34 UTC 2019
New revision: 505089
URL: https://svnweb.freebsd.org/changeset/ports/505089

Log:
  sysutils/shim: unbreak build with GCC 9

  PR:		238654
  Submitted by:	tobik
  Approved by:	mentors (implicit)
  Obtained from:	https://github.com/rhboot/shim/pull/170

Changes:
  head/sysutils/shim/Makefile
  head/sysutils/shim/files/patch-MokManager.c
Comment 3 Vinícius Zavam freebsd_committer 2019-06-25 13:35:15 UTC
pesign (recently patched) and certutil used to simulate a signing process.
worked, using gcc 8 and 9 (with patch from this PR).