[PATCH] D109109: [MC] Recursively calculate symbol offset

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 25 19:29:03 PDT 2021


lhames added a comment.

In D109109#3015293 <https://reviews.llvm.org/D109109#3015293>, @lgrey wrote:

> In D109109#3013769 <https://reviews.llvm.org/D109109#3013769>, @lhames wrote:
>
>> I think the MachO behavior described in https://bugs.llvm.org/show_bug.cgi?id=19203 is broken, but I still don't think that we can change this until we have a plan to deal with instances of the buggy pattern in the wild -- that's a much bigger issue than underlying bug.
>
> What's a good path forward to fix that?

I don't thing there's a good path. Given that in-tree assembly is often associated with sensitive code (e.g. kernels and drivers) I think that we would have to put significant effort into making any changes in behavior visible. I can think of two long, awkward paths for this:

(1) We introduce an assembly directive that describes the expected assignment behavior: .llvm_pr19203=fixed|compat. On MachO, we could emit a warning when we encounter a buggy expression if that directive is unset, or set to compat: "Warning: Using llvm_pr19203 compat mode. Please audit or or regenerate your assembly, then switch to fixed". This directive would probably hang around forever (once it's added to the source it's going to be hard to get rid of again).

(2) We rely on assembler tool options, rather than a directive. We lose the ability to determine intended behavior from the source, but don't have to keep an oddball directive around forever. The option would go through a few phases:
Initially: --pr19203=compat (by default) -- If omitted or explicitly set to compat then this will issue the same warning as above. Explicitly setting '--pr19203=fixed' will silence the warning.
Then: --pr19203=fixed (by default) -- If set to compat this will issue a warning that pr203 compat support is going away, and the code should be urgently reviewed/fixed. If set to fixed this should issue a warning: "--pr19203=fixed is now the default. Please remove this option from your assembler invocation".
Sunset: --pr19203 generates an error if set to compat ("compat support is gone"). In 'fixed' mode it now warns that the option should be removed urgently, as the option itself is going away.
Finally: --pr19203 option is removed.

Given how infrequently some groups update compilers the length between the phases should probably be measured in years. This is especially true between 'Initially' and 'Then', when we change the default behavior.

There may be problems with these approaches that I haven't considered too -- either one would need to be discussed with the wider community before work started.

Are there any workarounds that you could apply to solve your issue? If so I'd be inclined to try those rather than tackling this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109109



More information about the llvm-commits mailing list