Re: [Xen-devel] [PATCH] rombios: work around clang's -Waddress-of-packed-member
>>> On 24.08.18 at 17:22, 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 > --- > tools/firmware/rombios/32bit/tcgbios/tcgbios.c | 7 +-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c > b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c > index fa22c4460a..581340da8e 100644 > --- a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c > +++ b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c > @@ -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, > - >u.r32.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 Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] rombios: work around clang's -Waddress-of-packed-member
On Fri, Aug 24, 2018 at 04:32:15PM +0100, Wei Liu wrote: > On Fri, Aug 24, 2018 at 10:30:37AM -0500, Doug Goldstein wrote: > > On Fri, Aug 24, 2018 at 04:22:15PM +0100, Wei Liu wrote: > > > 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 Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] rombios: work around clang's -Waddress-of-packed-member
On Fri, Aug 24, 2018 at 10:30:37AM -0500, Doug Goldstein wrote: > On Fri, Aug 24, 2018 at 04:22:15PM +0100, Wei Liu wrote: > > Building rombios with clang XXX fails with: Oops, I have meant to replace XXX with the right version number. Will fix that while committing. > > > > 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 > > Reviewed-by: Doug Goldstein ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] rombios: work around clang's -Waddress-of-packed-member
On Fri, Aug 24, 2018 at 04:22:15PM +0100, Wei Liu 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 Reviewed-by: Doug Goldstein ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH] 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. Signed-off-by: Wei Liu --- tools/firmware/rombios/32bit/tcgbios/tcgbios.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c index fa22c4460a..581340da8e 100644 --- a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c +++ b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c @@ -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, - >u.r32.edx); + ); + regs->u.r32.edx = edx; CLEAR_CF(); break; + } default: SET_CF(); } -- 2.11.0 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel