[PATCH] Preliminary support for dynamically loadable coff objects

David Majnemer david.majnemer at gmail.com
Mon Feb 23 18:48:38 PST 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/Object/COFFObjectFile.cpp:376
@@ -366,3 +375,3 @@
   const coff_section *Sec = toSec(Ref);
-  return Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;
+  return Sec->SizeOfRawData == 0;
 }
----------------
AndyAyers wrote:
> majnemer wrote:
> > What's the rationale for this change?
> I thought it better matched the intent of the comment in ObjectFile.h:
> 
>   // A section is 'virtual' if its contents aren't present in the object image.
> 
> For coff this means the section has no raw data, regardless of section characteristics. In practice it probably doesn't matter so I'd be happy to revert this if you prefer.
Compiling `char x[300];` as C++ with MSVC 2015 results in a .bss section with `SizeOfRawData` set to 0x12c.

The relevant text from the COFF spec is:
> The size of the section (for object files) or the size of the initialized data on disk (for image files).

Heh, I guess my formulation of `isSectionVirtual` was more appropriate for object files while yours is better for executables.

http://reviews.llvm.org/D7793

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list