[all-commits] [llvm/llvm-project] c18ed6: [Internalize] Preserve __stack_chk_fail in Interna...

Yuanfang Chen via All-commits all-commits at lists.llvm.org
Thu Oct 28 11:23:44 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c18ed698733ac0cd338d8b5d048a77f4b34d88e6
      https://github.com/llvm/llvm-project/commit/c18ed698733ac0cd338d8b5d048a77f4b34d88e6
  Author: Yuanfang Chen <yuanfang.chen at sony.com>
  Date:   2021-10-28 (Thu, 28 Oct 2021)

  Changed paths:
    M llvm/lib/Transforms/IPO/Internalize.cpp
    M llvm/test/ThinLTO/X86/builtin-nostrip.ll

  Log Message:
  -----------
  [Internalize] Preserve __stack_chk_fail in Internalizer correctly

Move the section collecting `AlwaysPreserved` up before any
`maybeInternalize` is called. Otherwise, functions in `AlwaysPreserved` (in this case, `__stack_chk_fail`)
are not preserved.

Reviewed By: MaskRay, tejohnson

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


  Commit: ac02bcad56f5769066a538bce76c51142671b7dc
      https://github.com/llvm/llvm-project/commit/ac02bcad56f5769066a538bce76c51142671b7dc
  Author: Yuanfang Chen <yuanfang.chen at sony.com>
  Date:   2021-10-28 (Thu, 28 Oct 2021)

  Changed paths:
    M llvm/lib/Object/IRSymtab.cpp
    A llvm/test/ThinLTO/X86/builtin-nostrip-aix.ll
    M llvm/test/ThinLTO/X86/builtin-nostrip.ll

  Log Message:
  -----------
  [IRSymTab] Mark __stack_chk_guard used

`__stack_chk_guard` is a global variable that has no uses before the LLVM code generation phase (how it is defined is platform-dependent). LTO needs to preserve this symbol for that reason. Currently, legacy LTO API preserves it by hardcoding the logic in Internalizer, but this symbol is not preserved by regular LTO API in thinlink phase. This patch marks `__stack_chk_guard` used during IR symbol table writing since this is how builtin functions are preserved by thinlink by using `RuntimeLibcalls.def`.

Reviewed By: MaskRay, tejohnson

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


Compare: https://github.com/llvm/llvm-project/compare/31a949fada87...ac02bcad56f5


More information about the All-commits mailing list