[all-commits] [llvm/llvm-project] be308c: [clang][Sparc] Fix __builtin_extract_return_addr etc.

James Y Knight via All-commits all-commits at lists.llvm.org
Tue Feb 8 23:16:44 PST 2022

  Branch: refs/heads/release/14.x
  Home:   https://github.com/llvm/llvm-project
  Commit: be308cf4cda010ca04e064f77bd5df307903314f
  Author: Rainer Orth <ro at gcc.gnu.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M clang/lib/CodeGen/TargetInfo.cpp
    M clang/test/CodeGen/builtins-sparc.c

  Log Message:
  [clang][Sparc] Fix __builtin_extract_return_addr etc.

While investigating the failures of `symbolize_pc.cpp` and
`symbolize_pc_inline.cpp` on SPARC (both Solaris and Linux), I noticed that
`__builtin_extract_return_addr` is a no-op in `clang` on all targets, while
`gcc` has non-default implementations for arm, mips, s390, and sparc.

This patch provides the SPARC implementation.  For background see
`SparcISelLowering.cpp` (`SparcTargetLowering::LowerReturn_32`), the SPARC
psABI p.3-12, `%i7` and p.3-16/17, and SCD 2.4.1, p.3P-10, `%i7` and

Tested (after enabling the `sanitizer_common` tests on SPARC) on

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

(cherry picked from commit efdd0a29b7eb6f3b6ca3fe9182a6c1085806c73a)

  Commit: 7246d583d6017dbea8baa453e78f26e145448d6e
  Author: Amilendra Kodithuwakku <Amilendra.Kodithuwakku at arm.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticCommonKinds.td
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/test/Driver/arm-security-options.c

  Log Message:
  [clang][ARM] Re-word PACBTI warning.

The original warning added in D115501 when pacbti is used with an
incompatible architecture was not exactly correct because it was
not really ignored and can affect codegen.

Therefore reword to say that the pacbti option is incompatible with
the given architecture.

Reviewed By: chill

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

(cherry picked from commit 424e850f1ebc3e7011cb4af44cb2d62c02a58fbe)

  Commit: f5f0bd8e3d972d040827c88adf1a9880ebcb821e
  Author: James Y Knight <jyknight at google.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M clang/include/clang/Basic/TargetInfo.h
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/CodeGen/alloc-fns-alignment.c

  Log Message:
  Revert "[Clang] Propagate guaranteed alignment for malloc and others"

The above change assumed that malloc (and friends) would always
allocate memory to getNewAlign(), even for allocations which have a
smaller size. This is not actually required by spec (a 1-byte
allocation may validly have 1-byte alignment).

Some real-world malloc implementations do not provide this guarantee,
and thus this optimization is breaking programs.

Fixes #53540

This reverts commit c2297544c04764237cedc523083c7be2fb3833d4.

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

(cherry picked from commit 9545976ff160e19805a84a06a7e59d446f9994d9)

Compare: https://github.com/llvm/llvm-project/compare/7607a39e9388...f5f0bd8e3d97

More information about the All-commits mailing list