Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC 9: new -Werror=address-of-packed-member errors #161

Closed
marxin opened this issue Jan 9, 2019 · 3 comments
Closed

GCC 9: new -Werror=address-of-packed-member errors #161

marxin opened this issue Jan 9, 2019 · 3 comments

Comments

@marxin
Copy link

marxin commented Jan 9, 2019

Using latest GCC, one can see:

[   16s] gcc -ggdb -O0 -fno-stack-protector -fno-strict-aliasing -fpic -fshort-wchar -Wall -Wsign-compare -Werror -fno-builtin -Werror=sign-compare -ffreestanding -std=gnu89 -I/usr/lib64/gcc/x86_64-suse-linux/9/include "-DDEFAULT_LOADER=L\"\\\\grubx64.efi\"" "-DDEFAULT_LOADER_CHAR=\"\\\\grubx64.efi\"" -nostdinc -I/home/abuild/rpmbuild/BUILD/shim-15+git47/Cryptlib -I/home/abuild/rpmbuild/BUILD/shim-15+git47/Cryptlib/Include -I/usr/include/efi -I/usr/include/efi/x86_64 -I/usr/include/efi/protocol -I/home/abuild/rpmbuild/BUILD/shim-15+git47/include -iquote /home/abuild/rpmbuild/BUILD/shim-15+git47 -iquote /home/abuild/rpmbuild/BUILD/shim-15+git47 -mno-mmx -mno-sse -mno-red-zone -nostdinc -maccumulate-outgoing-args -m64 -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI -DNO_BUILTIN_VA_FUNCS -DMDE_CPU_X64 -DPAGE_SIZE=4096 "-DEFI_ARCH=L\"x64\"" "-DDEBUGDIR=L\"/usr/lib/debug/usr/lib64/efi/shim.debug\""   -c -o MokManager.o MokManager.c
[   16s] MokManager.c: In function 'write_back_mok_list':
[   16s] MokManager.c:1056:19: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   16s]  1056 |   if (CompareGuid(&(list[i].Type), &X509_GUID) == 0)
[   16s]       |                   ^~~~~~~~~~~~~~~
[   16s] MokManager.c:1078:19: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   16s]  1078 |   if (CompareGuid(&(list[i].Type), &X509_GUID) == 0) {
[   16s]       |                   ^~~~~~~~~~~~~~~
[   16s] MokManager.c: In function 'delete_cert':
[   16s] MokManager.c:1119:19: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   16s]  1119 |   if (CompareGuid(&(mok[i].Type), &X509_GUID) != 0)
[   16s]       |                   ^~~~~~~~~~~~~~
[   16s] MokManager.c: In function 'delete_hash_in_list':
[   16s] MokManager.c:1170:20: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   16s]  1170 |   if ((CompareGuid(&(mok[i].Type), &Type) != 0) ||
[   16s]       |                    ^~~~~~~~~~~~~~
[   16s] MokManager.c: In function 'delete_keys':
[   16s] MokManager.c:1334:19: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   16s]  1334 |   if (CompareGuid(&(del_key[i].Type), &X509_GUID) == 0) {
[   16s]       |                   ^~~~~~~~~~~~~~~~~~
[   17s] cc1: all warnings being treated as errors
[   17s] make: *** [<builtin>: MokManager.o] Error 1

@marxin
Copy link
Author

marxin commented Feb 22, 2019

May I please remind this issue?

lcp added a commit to lcp/shim that referenced this issue Feb 26, 2019
Fix the errors from gcc9 '-Werror=address-of-packed-member'

rhboot#161

Signed-off-by: Gary Lin <glin@suse.com>
vathpela pushed a commit to vathpela/mallory that referenced this issue Dec 5, 2019
Fix the errors from gcc9 '-Werror=address-of-packed-member'

rhboot#161

Signed-off-by: Gary Lin <glin@suse.com>
@smcv
Copy link

smcv commented Feb 13, 2020

58532e1 appears to be a solution to this?

@marxin
Copy link
Author

marxin commented Feb 13, 2020

58532e1 appears to be a solution to this?

I can confirm that.

@marxin marxin closed this as completed Feb 13, 2020
vathpela pushed a commit that referenced this issue Sep 9, 2020
Fix the errors from gcc9 '-Werror=address-of-packed-member'

#161

Signed-off-by: Gary Lin <glin@suse.com>
Upstream-commit-id: aaa09b3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants