[PATCH] Preliminary support for dynamically loadable coff objects

Andy Ayers andya at microsoft.com
Tue Feb 24 10:42:29 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;
 }
----------------
majnemer wrote:
> 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.
Perhaps a better check is if PointerToRawData is zero, this should work in both obj and pe cases?

http://reviews.llvm.org/D7793

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






More information about the llvm-commits mailing list