rombios: work around clang's -Waddress-of-packed-member
PATCH 1/1 rombios: work around clang's -Waddress-of-packed-member
Building rombios with clang XXX fails with:
tcgbios.c:1519:34: error: taking address of packed member 'u' of class or structure 'pushad_regs_t' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
®s->u.r32.edx);
^~~~~~~~~~~~~~~Work around that by using an intermediate variable.
--- tools/firmware/rombios/32bit/tcgbios/tcgbios.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tools/firmware/rombios/32bit/tcgbios/tcgbios.c +5 -2
@@ -1507,7 +1507,8 @@ uint32_t TCGInterruptHandler(pushad_regs_t *regs, uint32_t esds, regs->u.r32.edx);CLEAR_CF ();break ; -case 0x07 : + case 0x07: { + uint32_t edx = regs->u.r32.edx; regs->u.r32.eax = CompactHashLogExtendEvent32((unsigned char *) ADDR_FROM_SEG_OFF(ES,
@@ -1516,9 +1517,11 @@ uint32_t TCGInterruptHandler(pushad_regs_t *regs, uint32_t esds, regs->u.r32.ebx, regs->u.r32.ecx, regs->u.r32.edx, - ®s->u.r32.edx); + &edx); + regs->u.r32.edx = edx;CLEAR_CF ();break ; + }default :SET_CF (); }
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines · Wei Liu
Building rombios with clang XXX fails with:
tcgbios.c:1519:34: error: taking address of packed member 'u' of class or structure '
pushad_regs_t' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]®s->u.r32.edx); ^~~~~~~~~~~~~~~Work around that by using an intermediate variable.
Signed-off-by Wei Liu <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 2 lines · Doug Goldstein
Quoted 1 line · Wei Liu
Building rombios with clang XXX fails with:
Oops, I have meant to replace XXX with the right version number.
Will fix that while committing.
Quoted 10 lines
Quoted 8 lines
tcgbios.c:1519:34: error: taking address of packed member 'u' of class or structure '
pushad_regs_t' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]®s->u.r32.edx); ^~~~~~~~~~~~~~~Work around that by using an intermediate variable.
Signed-off-by Wei Liu <[email protected]>Reviewed-by Doug Goldstein <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines · Wei Liu
Quoted 2 lines · Doug Goldstein
Quoted 1 line · Wei Liu
Building rombios with clang XXX fails with:
Oops, I have meant to replace XXX with the right version number.
Will fix that while committing.
The version used in Debian unstable is 6.0.1-2 (tags/RELEASE_601/final)
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 32 lines
Quoted 1 line
Quoted 1 line · On 24.08.18 at 17:22, <[email protected]> wrote:
Building rombios with clang XXX fails with:
tcgbios.c:1519:34: error: taking address of packed member 'u' of class or structure '
pushad_regs_t' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]®s->u.r32.edx); ^~~~~~~~~~~~~~~Work around that by using an intermediate variable.
Signed-off-by Wei Liu <[email protected]>--- tools/firmware/rombios/32bit/tcgbios/tcgbios.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)tools/firmware/rombios/32bit/tcgbios/tcgbios.c +2
-1@@ -1507,7 +1507,8 @@ uint32_t TCGInterruptHandler(pushad_regs_t *regs, uint32_t esds, regs->u.r32.edx);CLEAR_CF ();break ; -case 0x07 : + case 0x07: { + uint32_t edx = regs->u.r32.edx; regs->u.r32.eax = CompactHashLogExtendEvent32((unsigned char *) ADDR_FROM_SEG_OFF(ES,
tools/firmware/rombios/32bit/tcgbios/tcgbios.c uint32_t TCGInterruptHandler(pushad_regs_t *regs, uint32_t esds, · line 1524
Quoted 9 lines
tools/firmware/rombios/32bit/tcgbios/tcgbios.c +3
-1@@ -1516,9 +1517,11 @@ uint32_t TCGInterruptHandler(pushad_regs_t *regs, uint32_t esds, regs->u.r32.ebx, regs->u.r32.ecx, regs->u.r32.edx, - ®s->u.r32.edx); + &edx); + regs->u.r32.edx = edx;CLEAR_CF ();break ; + }
Hmm, this addresses a specific instance of the problem. In this (I think) never changing code base doing so might be okay, but is there a reason not to fix the root of the problem - remove the bogus packed attribute? The structure definition in 32bit/rombios_compat.h spells out all padding fields, and I can't spot any other (side) effect the attribute would have, the more that it's only the outermost structure which gets the attribute applied.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel