[PATCH] D32064: [asan] Disable ASan global-GC depending on the target and compiler flags

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 17 15:41:47 PDT 2017


rnk added inline comments.


================
Comment at: lib/Driver/SanitizerArgs.cpp:636
+  case llvm::Triple::COFF:
+    return DataSections;
+  case llvm::Triple::ELF:
----------------
eugenis wrote:
> rnk wrote:
> > We can return true for COFF here. By adding a comdat during asan instrumentation, we effectively implement -fdata-sections ourselves. If the user really wanted -fno-data-sections for some reason, they're out of luck right now.
> What do you mean by "out of luck", will it break compilation?
> Because the point of this change is not to enable data-sections unless asked by the user. Data sections greatly inflate ELF object file size (not sure how big is the effect on COFF) and we should not do that by default.
By "out of luck", I was thinking about users who might do crazy things like take label differences between globals and assume that they are laid out consecutively in the original source file order. I wasn't thinking about object file size.

The size increase for COFF is probably comparable, so I guess I agree, this is reasonable behavior. I think Chromium explicitly passes `/Gw`, which is equivalent to `-fdata-sections`. We basically don't support non-integrated as on Windows at this point. We've extended the assembler a number of times already.


Repository:
  rL LLVM

https://reviews.llvm.org/D32064





More information about the cfe-commits mailing list