[all-commits] [llvm/llvm-project] eb0f1d: [LLD][ELF] Include offset when adding Thunk symbol...

Peter Smith via All-commits all-commits at lists.llvm.org
Fri Jun 20 02:12:03 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: eb0f1dc00e5d0e591fe912c1aaf9dd9d01d94b8d
      https://github.com/llvm/llvm-project/commit/eb0f1dc00e5d0e591fe912c1aaf9dd9d01d94b8d
  Author: Peter Smith <peter.smith at arm.com>
  Date:   2025-06-20 (Fri, 20 Jun 2025)

  Changed paths:
    M lld/ELF/Thunks.cpp
    M lld/test/ELF/aarch64-thunk-bti-multipass.s

  Log Message:
  -----------
  [LLD][ELF] Include offset when adding Thunk symbols (#144995)

Include the offset of a thunk in the ThunkSection when adding symbols.

At Thunk creation time the offset is set to 0 as we don't know where in
the ThunkSection the Thunk will end up. The symbol values are updated by
the setOffset() call in assignOffsets().

When we transform a thunk from a short to a long, we sometimes add a
mapping symbol. At this point the offset of the thunk is non zero and we
need to account for that when defining the symbol, as the setOffset()
call subtracts the offset before adding the new one back in.

To test; added a second thunk that is converted to a long thunk to
aarch64-thunk-bit-multipass. This second thunk is given a non zero
offset from the start of the Thunk Section so we can observe the mapping
symbol being put in the wrong place without accounting for the offset.

fixes: https://github.com/llvm/llvm-project/issues/142326



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list