[PATCH] D97446: Change some addUsedGlobal to addUsedOrCompilerUsedGlobal

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 25 10:08:25 PST 2021


probinson added a comment.

In D97446#2587996 <https://reviews.llvm.org/D97446#2587996>, @MaskRay wrote:

> In D97446#2587806 <https://reviews.llvm.org/D97446#2587806>, @probinson wrote:
>
>>> GNU ld has a rule "start_/stop_ references from a live input section retain the associated C identifier name sections", which LLD may change in the future (D96914 <https://reviews.llvm.org/D96914>).
>>
>> The phrasing "may change" implies LLD could eliminate the rule; in fact D96914 <https://reviews.llvm.org/D96914> will only add a way to opt-out of the rule.  You can't eliminate the rule entirely without breaking a lot of useful cases.
>
> Reworded this sentence. D96914 <https://reviews.llvm.org/D96914> does add a way to opt-out of the rule. In the future (when toolchains are more mature) we may try. My internal tests and Linux kernel tests are try to state that we may not have many dependent cases.

My guess is that many use-cases for `__start_/__stop_` and `used` sections are in test and debugging code; it might not be obvious where a dependency is, and it might well be the case that GC-ing these sections will make something useless without actively breaking it.  The behavior of `__start_/__stop_` has been in place for a very long time, IIUC, and it would be very hard to prove that nothing bad will happen if you eliminate that behavior.  I don't think "Linux will still boot" is a particularly exhaustive test case.

Rather than just make vague worried noises, I will work on putting up a patch with my particular use-case, and we can see whether I am worried over nothing.  If we're lucky I can do that tomorrow, or it might take another week.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97446



More information about the cfe-commits mailing list