[PATCH] D152604: [Driver] Default -fsanitize-address-globals-dead-stripping to true for ELF

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 12 14:31:45 PDT 2023


MaskRay added a comment.

In D152604#4415392 <https://reviews.llvm.org/D152604#4415392>, @rnk wrote:

> I think there's a fair bit more cleanup and simplification to be done, see asanUsesGlobalsGC <https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/BackendUtil.cpp#L232> and the comments there. We could check CGOpts.DataSections right there, for example, and rip out the whole cc1 option. Feel free to approach it incrementally, this makes sense to me policy wise.

Thanks for mentioning this piece of code. It seems that I forgot to update this comment in D120394 <https://reviews.llvm.org/D120394> that allowed `-fno-data-sections -fsanitize-address-globals-dead-stripping`.

I have thought about not applying `-fsanitize-address-globals-dead-stripping` in `-fno-data-sections` mode, so that we won't have sections like `.bss.a`, but the driver complexity/cognitive load is high, so I think we should make `-fsanitize-address-globals-dead-stripping` default to true. (PS defaults to `-fdata-sections`, but Fuchsia doesn't.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152604/new/

https://reviews.llvm.org/D152604



More information about the cfe-commits mailing list