[llvm-commits] [llvm] r169438 - /llvm/trunk/tools/llvm-objdump/COFFDump.cpp

Michael Spencer bigcheesegs at gmail.com
Wed Dec 5 14:55:34 PST 2012


On Wed, Dec 5, 2012 at 2:38 PM, Michael J. Spencer
<bigcheesegs at gmail.com> wrote:
> Author: mspencer
> Date: Wed Dec  5 16:38:01 2012
> New Revision: 169438
>
> URL: http://llvm.org/viewvc/llvm-project?rev=169438&view=rev
> Log:
> Quick build fix for c++03 clang. This needs a proper solution. Note that these offsets are guaranteed to be correct by Endian.h.
>
> Modified:
>     llvm/trunk/tools/llvm-objdump/COFFDump.cpp
>
> Modified: llvm/trunk/tools/llvm-objdump/COFFDump.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/COFFDump.cpp?rev=169438&r1=169437&r2=169438&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-objdump/COFFDump.cpp (original)
> +++ llvm/trunk/tools/llvm-objdump/COFFDump.cpp Wed Dec  5 16:38:01 2012
> @@ -277,26 +277,26 @@
>
>        outs() << "  Start Address: ";
>        printCOFFSymbolAddress(outs(), Rels, SectionOffset +
> -                             offsetof(RuntimeFunction, StartAddress),
> +                             /*offsetof(RuntimeFunction, StartAddress)*/ 0,
>                               I->StartAddress);
>        outs() << "\n";
>
>        outs() << "  End Address: ";
>        printCOFFSymbolAddress(outs(), Rels, SectionOffset +
> -                             offsetof(RuntimeFunction, EndAddress),
> +                             /*offsetof(RuntimeFunction, EndAddress)*/ 4,
>                               I->EndAddress);
>        outs() << "\n";
>
>        outs() << "  Unwind Info Address: ";
>        printCOFFSymbolAddress(outs(), Rels, SectionOffset +
> -                             offsetof(RuntimeFunction, UnwindInfoOffset),
> +                             /*offsetof(RuntimeFunction, UnwindInfoOffset)*/ 8,
>                               I->UnwindInfoOffset);
>        outs() << "\n";
>
>        ArrayRef<uint8_t> XContents;
>        uint64_t UnwindInfoOffset = 0;
>        if (error(getSectionContents(Obj, Rels, SectionOffset +
> -                                   offsetof(RuntimeFunction, UnwindInfoOffset),
> +                              /*offsetof(RuntimeFunction, UnwindInfoOffset)*/ 8,
>                                     XContents, UnwindInfoOffset))) continue;
>        if (XContents.empty()) continue;
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Kai,

Please fix this in a less hacky way.

The problem is that RuntimeFunction is not a POD type in c++03, and
offsetof is only well defined for POD types. clang warns on this in
c++03 mode.

- Michael Spencer



More information about the llvm-commits mailing list