[all-commits] [llvm/llvm-project] 10cda6: [lld/mac] Give range extension thunks for local sy...

Nico Weber via All-commits all-commits at lists.llvm.org
Wed Mar 30 13:49:38 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 10cda6e36c05f83c8893e953b7a0f39ca8994ea3
      https://github.com/llvm/llvm-project/commit/10cda6e36c05f83c8893e953b7a0f39ca8994ea3
  Author: Nico Weber <thakis at chromium.org>
  Date:   2022-03-30 (Wed, 30 Mar 2022)

  Changed paths:
    M lld/MachO/ConcatOutputSection.cpp
    M lld/test/MachO/arm64-thunk-starvation.s
    A lld/test/MachO/arm64-thunk-visibility.s

  Log Message:
  -----------
  [lld/mac] Give range extension thunks for local symbols local visibility

When two local symbols (think: file-scope static functions, or functions in
unnamed namespaces) with the same name in two different translation units
both needed thunks, ld64.lld previously created external thunks for both
of them. These thunks ended up with the same name, leading to a duplicate
symbol error for the thunk symbols.

Instead, give thunks for local symbols local visibility.

(Hitting this requires a jump to a local symbol from over 128 MiB away.
It's unlikely that a single .o file is 128 MiB large, but with ICF
you can end up with a situation where the local symbol is ICF'd with
a symbol in a separate translation unit. And that can introduce a
large enough jump to require a thunk.)

Fixes PR54599.

Differential Revision: https://reviews.llvm.org/D122624




More information about the All-commits mailing list