diff options
author | Guy Harris <guy@alum.mit.edu> | 2010-08-14 17:31:04 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2010-08-14 17:31:04 -0700 |
commit | eeabdc9b78880fc7e5aa5271113defa733966a4b (patch) | |
tree | ffc07d2d073fbcf9b42ead4e428ae8bb3be1fb54 /llc.h | |
parent | 56a1b4f36fb021fced422195f2c2a4b18003ec87 (diff) | |
download | tcpdump-eeabdc9b78880fc7e5aa5271113defa733966a4b.tar.gz |
Prevent GCC from doing some alignment-unsafe optimizations on SPARC.
At least some versions of GCC will, on SPARC, generate code for
if (bp->bp_htype == 1 && bp->bp_hlen == 6 && bp->bp_op == BOOTPREQUEST) {
where bp is a pointer to a struct bootp, that loads the first 4-byte
word in that structure, masks out the field in that structure that's not
being compared, and compares against a word with the appropriate values
in the other fields. That won't work, because there's no guarantee that
bp points to a value aligned on a 4-byte boundary.
Declaring "struct bootp" to be packed appears to keep at least GCC 4.2.4
from performing that optimization; we define an "UNALIGNED" tag to apply
to structures to prevent that optimization, and apply that tag to the
structures in bootp.h. (We'll apply it to other structures as we
discover the need for it.)
Diffstat (limited to 'llc.h')
0 files changed, 0 insertions, 0 deletions