[all-commits] [llvm/llvm-project] 99e735: IRSymTab: Record _GLOBAL_OFFSET_TABLE_ for ELF x86

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Apr 23 17:02:44 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 99e7350235055654aaa923701bf36adaf01739d0
      https://github.com/llvm/llvm-project/commit/99e7350235055654aaa923701bf36adaf01739d0
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-04-23 (Tue, 23 Apr 2024)

  Changed paths:
    A lld/test/ELF/lto/i386-global-offset-table.ll
    A lld/test/ELF/lto/x86-64-global-offset-table.ll
    M llvm/lib/Object/ModuleSymbolTable.cpp
    M llvm/test/LTO/X86/codemodel-2.ll
    M llvm/test/LTO/X86/codemodel-3.ll
    M llvm/test/LTO/X86/largedatathreshold-1.ll
    M llvm/test/LTO/X86/largedatathreshold-2.ll
    M llvm/test/LTO/X86/largedatathreshold-3.ll

  Log Message:
  -----------
  IRSymTab: Record _GLOBAL_OFFSET_TABLE_ for ELF x86

In ELF, relocatable files generated for x86-32 and some code models of
x86-64 (medium, large) may reference the special symbol
`_GLOBAL_OFFSET_TABLE_` that is not used in the IR. In an LTO link, if
there is no regular relocatable file referencing the special symbol, the
linker may not define the symbol and lead to a spurious "undefined
symbol" error.

Fix #61101: record that `_GLOBAL_OFFSET_TABLE_` is used in the IR symbol
table.

Note: The `PreservedSymbols` mechanism
(https://reviews.llvm.org/D112595) that just sets `FB_used` is not
applicable.
The `getRuntimeLibcallSymbols` for extracting lazy runtime library
symbols is for symbols that are "always" potentially used, but linkers
don't have the code model information to make a precise decision.

Pull Request: https://github.com/llvm/llvm-project/pull/89463



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