[PATCH] D96914: [ELF] Add -z start-stop-gc to let __start_/__stop_ not retain C identifier name sections

Harald van Dijk via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 12 12:23:51 PST 2021


hvdijk added a comment.

In D96914#3128155 <https://reviews.llvm.org/D96914#3128155>, @MaskRay wrote:

> (I shall note that declaring reserved identifiers `__start_` is UB in the first place. Well, the compiler has just always been just permissive.)

It's UB from a C and C++ standards POV, it's not UB from an LLVM POV. It's the LLVM POV that's relevant here, C and C++ UB that falls under a supported LLVM extension needs to behave as specified by that extension. Changes to the behaviour of that extension can be made (both in spec and in code), sure, but the fact that they are outside of the scope of the C and C++ standards doesn't automatically make them okay. If I were to commit a patch to clang to issue a hard error whenever an identifier starting with `__` is used outside of a standard library header, I would expect that patch to be reverted promptly, and rightly so.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96914



More information about the llvm-commits mailing list