[llvm] [AArch64, ELF] Allow implicit $d/$x at section beginning (PR #99718)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 10:20:30 PDT 2024


MaskRay wrote:

> Although possibly not for this patch. It looks llvm-objdump (and gnu objdump) look to reorder $x after $d when the symbols are at the same address. This looks like worse case behaviour.

Yes, the -fsanitize=function and -fsanitize=kcfi cases that many people don't use.
In particular, as a contributor of -fsanitize=kcfi, I think the feature should not be used for userspace programs.
They are specific to the Linux kernel, which expects a specific conditional branch instruction and a specific trap instruction.
(FreeBSD kernel could adopt it if they decide to do something similar to the Linux kernel.)

> I think we could address this by looking at llvm-objdump, or we could have lld filter out the clashes.

Yes. The test intends to demonstrate the weakness.

> The other tool that I thought could be affected by this is Bolt. It uses mapping symbols to determine the location of constant islands. It looks to do this with CodeOffsets and DataOffsets (some references below). Are your large programs likely to be post-processed by Bolt?

No, not post-processed by BOLT.

> Do you want to update llvm-objdump as whatever collation order the linker uses, it is going to order $d before $x? I think that could be done in different patch.

Yes, I will take a stab.

* If Bolt could get confused by two symbols at the same address I think we'll need to call that out in the clang driver help text. Do you think it would be worth an lld patch to remove (or make both symbols the same) when there is a clash? That would make Bolt work for a LLVM based toolchain.

I want to change `clang -Wa,` options to use TableGen so that we can place additional help messages.
Right now `-Wa,` options don't have a way to provide messages.
`clang/docs/UsersManual.rst` might also be a choice, if we don't add messages to `--help`.

Currently, we could only rely on the `cl::opt` message. I feel that BOLT is a very specific detail that cannot be well described a brief message...

---

Enjoy your vacation! I'll take a flight on Friday and will be slow to respond for about 3 weeks.

https://github.com/llvm/llvm-project/pull/99718


More information about the llvm-commits mailing list