This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Provide a hint about --no-check-sections
AbandonedPublic

Authored by grimar on Mar 30 2018, 2:34 AM.

Details

Summary

This adds a hint about --no-check-sections option to the
sections overlapping error message.

One known legal use case for this option is OVERLAYS,
which are not yet supported in LLD, though with --no-check-sections
it would be possible to write linker script equal by functionality to
OVERLAY syntax.

Diff Detail

Event Timeline

grimar created this revision.Mar 30 2018, 2:34 AM
ruiu added a comment.Mar 30 2018, 10:11 AM

You can either disable error checking or ignore errors, but "ignoring this check" doesn't make much sense.

In what situation this hint is useful? Showing a hint suggests people do that, but IIUC, overlapping sections is almost always an error, and it is pretty rare that you need --no-check-sections option. It may give a wrong impression that the error can be resolved by passing that option.

You can either disable error checking or ignore errors, but "ignoring this check" doesn't make much sense.

In what situation this hint is useful? Showing a hint suggests people do that, but IIUC, overlapping sections is almost always an error, and it is pretty rare that you need --no-check-sections option. It may give a wrong impression that the error can be resolved by passing that option.

In this message, I am saying "if you need overlays". That suggests that user *need* it. It is for cases like PR36768. LLD does not support OVERLAYS, though it is a possible legal thing to do.

grimar updated this revision to Diff 140608.Apr 2 2018, 12:54 AM
  • Addressed review comment (updated error message wording).
ruiu added a comment.Apr 2 2018, 11:01 AM

In this message, I am saying "if you need overlays". That suggests that user *need* it. It is for cases like PR36768. LLD does not support OVERLAYS, though it is a possible legal thing to do.

As I said, if you show something, it suggests users do it even if the hint message comes with a footnote. You cannot really trust all users to understand what "if you need overlays" means. I think you can easily imagine that a user seeing that error message blindly adds that option to "fix" the problem. Unlike you, users are not linker experts, and our hint messages must be relevant to most users, or otherwise it could do harm than good.

Say, do you think that a half of the users who saw this hint message actually need --no-check-sections? I honestly don't think so. I cannot even imagine that 10% users who saw this error message have needed --no-check-sections because it is hard to imagine that you want to intentionally create overlapped sections.

grimar added a comment.Apr 3 2018, 7:14 AM

In this message, I am saying "if you need overlays". That suggests that user *need* it. It is for cases like PR36768. LLD does not support OVERLAYS, though it is a possible legal thing to do.

As I said, if you show something, it suggests users do it even if the hint message comes with a footnote. You cannot really trust all users to understand what "if you need overlays" means. I think you can easily imagine that a user seeing that error message blindly adds that option to "fix" the problem. Unlike you, users are not linker experts, and our hint messages must be relevant to most users, or otherwise it could do harm than good.

Say, do you think that a half of the users who saw this hint message actually need --no-check-sections? I honestly don't think so. I cannot even imagine that 10% users who saw this error message have needed --no-check-sections because it is hard to imagine that you want to intentionally create overlapped sections.

I generally find it difficult to imagine a user who sees this error honestly. If you write straightforward linker scripts without moving location counter backwards,
I guess such an error is either impossible or means we have a bug in linker. If you don't then most probably you write some kernel script and should know what you do :)
What is the difference with the "pass '-Wl,-z,notext' to allow text relocations in the output" hint we provide, btw? It is also can be an error, though we hint here.

I think the main use case we really want to think about is a case when somebody tries to switch from bfd to LLD. In this case, providing such a hint would help this user
to resolve the issue. It is user-friendly. First of all, the issue happens because we are incompatible with tools that users used for decades and forcing them to search
in the web or read help about all options we support to make things just work again is not a great experience.

There is a discussion in PR36768's comments about the new option for allowing overlays.
With that, "--no-check-sections" hint for all kind of overlaps will not make sense.
We might add a just hint for VA overlaps specific to OVERLAY feature only then.

grimar abandoned this revision.May 15 2018, 7:36 AM

We will not need this when/if we land OVERLAYs (D44780).