[llvm-branch-commits] [clang] 500889f - [MIPS] Add `-no-pie` option to the clang driver's tests depend on it

2022-02-25 Thread Fangrui Song via llvm-branch-commits

Author: Simon Atanasyan
Date: 2022-02-25T01:28:59-08:00
New Revision: 500889f56bce937a1263d5daf4a3bb76084ea188

URL: 
https://github.com/llvm/llvm-project/commit/500889f56bce937a1263d5daf4a3bb76084ea188
DIFF: 
https://github.com/llvm/llvm-project/commit/500889f56bce937a1263d5daf4a3bb76084ea188.diff

LOG: [MIPS] Add `-no-pie` option to the clang driver's tests depend on it

(cherry picked from commit cedc23bc8612feea61c0a7d92ccaae1ce51520ce)

Added: 


Modified: 
clang/test/Driver/mips-cs.cpp
clang/test/Driver/mips-fsf.cpp
clang/test/Driver/mips-img-v2.cpp
clang/test/Driver/mips-img.cpp
clang/test/Driver/mips-mti-linux.c

Removed: 




diff  --git a/clang/test/Driver/mips-cs.cpp b/clang/test/Driver/mips-cs.cpp
index 6ef4c5d4350cd..39f87d8fd8354 100644
--- a/clang/test/Driver/mips-cs.cpp
+++ b/clang/test/Driver/mips-cs.cpp
@@ -4,7 +4,7 @@
 //
 // = Big-endian, hard float
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=mips-linux-gnu \
+// RUN: --target=mips-linux-gnu -no-pie \
 // RUN: -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/mips_cs_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-BE-HF-32 %s
 // CHECK-BE-HF-32: "-internal-isystem"
@@ -32,7 +32,7 @@
 //
 // = Big-endian, hard float, uclibc
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=mips-linux-gnu -muclibc \
+// RUN: --target=mips-linux-gnu -muclibc -no-pie \
 // RUN: -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/mips_cs_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-BE-UC-HF-32 %s
 // CHECK-BE-UC-HF-32: "-internal-isystem"
@@ -61,7 +61,7 @@
 //
 // = Big-endian, hard float, mips16
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=mips-linux-gnu -mips16 \
+// RUN: --target=mips-linux-gnu -mips16 -no-pie \
 // RUN: -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/mips_cs_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-BE-HF-16 %s
 // CHECK-BE-HF-16: "-internal-isystem"
@@ -90,7 +90,7 @@
 //
 // = Big-endian, hard float, mmicromips
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=mips-linux-gnu -mmicromips \
+// RUN: --target=mips-linux-gnu -mmicromips -no-pie \
 // RUN: -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/mips_cs_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-BE-HF-MICRO %s
 // CHECK-BE-HF-MICRO: "-internal-isystem"
@@ -119,7 +119,7 @@
 //
 // = Big-endian, hard float, nan2008
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=mips-linux-gnu -mnan=2008 \
+// RUN: --target=mips-linux-gnu -mnan=2008 -no-pie \
 // RUN: -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/mips_cs_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-BE-HF-NAN %s
 // CHECK-BE-HF-NAN: "-internal-isystem"
@@ -148,7 +148,7 @@
 //
 // = Big-endian, hard float, uclibc, nan2008
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=mips-linux-gnu -muclibc -mnan=2008 \
+// RUN: --target=mips-linux-gnu -muclibc -mnan=2008 -no-pie \
 // RUN: -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/mips_cs_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-BE-UC-HF-NAN %s
 // CHECK-BE-UC-HF-NAN: "-internal-isystem"
@@ -177,7 +177,7 @@
 //
 // = Big-endian, soft float
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=mips-linux-gnu -msoft-float \
+// RUN: --target=mips-linux-gnu -msoft-float -no-pie \
 // RUN: -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/mips_cs_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-BE-SF-32 %s
 // CHECK-BE-SF-32: "-internal-isystem"
@@ -206,7 +206,7 @@
 //
 // = Big-endian, soft float, uclibc
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=mips-linux-gnu -muclibc -msoft-float \
+// RUN: --target=mips-linux-gnu -muclibc -msoft-float -no-pie \
 // RUN: -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/mips_cs_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-BE-UC-SF-32 %s
 // CHECK-BE-UC-SF-32: "-internal-isystem"
@@ -235,7 +235,7 @@
 //
 // = Big-endian, soft float, mips16
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=mips-linux-gnu -msoft-float -mips16 \
+// RUN: --target=mips-linux-gnu -msoft-float -mips16 -no-pie \
 // RUN: -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/mips_cs_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-BE-SF-16 %s
 // CHECK-BE-SF-16: "-internal-isystem"
@@ -264,7 +264,7 @@
 //
 // = Big-endian, soft float, micromips
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=mips-linux-gnu -msoft-float -mmicromips \
+// RUN: --target=mips-linux-gnu -msoft-float -mmicromips -no-pie \
 // RUN: -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/mips_cs_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-BE-SF-MICRO %s
 // CHECK-BE-SF-MICRO: 

[llvm-branch-commits] [clang] 443f68c - [clang][test] Make mips-vector-return.c work with CLANG_DEFAULT_PIE_ON_LINUX=on

2022-02-25 Thread Fangrui Song via llvm-branch-commits

Author: Fangrui Song
Date: 2022-02-25T01:30:13-08:00
New Revision: 443f68c280aca3dacb01fd4036901808c10dc525

URL: 
https://github.com/llvm/llvm-project/commit/443f68c280aca3dacb01fd4036901808c10dc525
DIFF: 
https://github.com/llvm/llvm-project/commit/443f68c280aca3dacb01fd4036901808c10dc525.diff

LOG: [clang][test] Make mips-vector-return.c work with 
CLANG_DEFAULT_PIE_ON_LINUX=on

(cherry picked from commit da047445f77bfd74b04c36169e104f35dbfff84e)

Added: 


Modified: 
clang/test/CodeGen/mips-vector-return.c

Removed: 




diff  --git a/clang/test/CodeGen/mips-vector-return.c 
b/clang/test/CodeGen/mips-vector-return.c
index dfb0ca304dbe7..fe39f91f293ce 100644
--- a/clang/test/CodeGen/mips-vector-return.c
+++ b/clang/test/CodeGen/mips-vector-return.c
@@ -1,5 +1,5 @@
-// RUN: %clang -target mipsel-unknown-linux -O3 -S -o - -emit-llvm %s | 
FileCheck %s -check-prefix=O32
-// RUN: %clang -target mips64el-unknown-linux -O3 -S -mabi=n64 -o - -emit-llvm 
%s | FileCheck %s -check-prefix=N64
+// RUN: %clang_cc1 -triple mipsel-unknown-linux -O3 -S -o - -emit-llvm %s | 
FileCheck %s -check-prefix=O32
+// RUN: %clang_cc1 -triple mips64el-unknown-linux -O3 -S -target-abi n64 -o - 
-emit-llvm %s | FileCheck %s -check-prefix=N64
 
 // vectors larger than 16-bytes are returned via the hidden pointer argument. 
 // N64/N32 returns vectors whose size is equal to or smaller than 16-bytes in
@@ -8,14 +8,14 @@ typedef float  v4sf __attribute__ ((__vector_size__ (16)));
 typedef double v4df __attribute__ ((__vector_size__ (32)));
 typedef int v4i32 __attribute__ ((__vector_size__ (16)));
 
-// O32-LABEL: define dso_local void @test_v4sf(<4 x float>* noalias nocapture 
writeonly sret
-// N64: define inreg { i64, i64 } @test_v4sf
+// O32-LABEL: define{{.*}} void @test_v4sf(<4 x float>* noalias nocapture 
writeonly sret
+// N64: define{{.*}} inreg { i64, i64 } @test_v4sf
 v4sf test_v4sf(float a) {
   return (v4sf){0.0f, a, 0.0f, 0.0f};
 }
 
-// O32-LABEL: define dso_local void @test_v4df(<4 x double>* noalias nocapture 
writeonly sret
-// N64-LABEL: define void @test_v4df(<4 x double>* noalias nocapture writeonly 
sret
+// O32-LABEL: define{{.*}} void @test_v4df(<4 x double>* noalias nocapture 
writeonly sret
+// N64-LABEL: define{{.*}} void @test_v4df(<4 x double>* noalias nocapture 
writeonly sret
 v4df test_v4df(double a) {
   return (v4df){0.0, a, 0.0, 0.0};
 }
@@ -23,8 +23,8 @@ v4df test_v4df(double a) {
 // O32 returns integer vectors whose size is equal to or smaller than 16-bytes
 // in integer registers.
 //
-// O32: define dso_local inreg { i32, i32, i32, i32 } @test_v4i32
-// N64: define inreg { i64, i64 } @test_v4i32
+// O32: define{{.*}} inreg { i32, i32, i32, i32 } @test_v4i32
+// N64: define{{.*}} inreg { i64, i64 } @test_v4i32
 v4i32 test_v4i32(int a) {
   return (v4i32){0, a, 0, 0};
 }



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 2a492df - [Driver][test] Make hexagon-toolchain-elf.c work with CLANG_DEFAULT_PIE_ON_LINUX=on

2022-02-25 Thread Fangrui Song via llvm-branch-commits

Author: Fangrui Song
Date: 2022-02-25T01:30:18-08:00
New Revision: 2a492dfd6b4edf21bfd05aa5e18c81ec89b04250

URL: 
https://github.com/llvm/llvm-project/commit/2a492dfd6b4edf21bfd05aa5e18c81ec89b04250
DIFF: 
https://github.com/llvm/llvm-project/commit/2a492dfd6b4edf21bfd05aa5e18c81ec89b04250.diff

LOG: [Driver][test] Make hexagon-toolchain-elf.c work with 
CLANG_DEFAULT_PIE_ON_LINUX=on

(cherry picked from commit deee339796ccffc267d4e1846f4b8203f3f1a485)

Added: 


Modified: 
clang/test/Driver/hexagon-toolchain-elf.c

Removed: 




diff  --git a/clang/test/Driver/hexagon-toolchain-elf.c 
b/clang/test/Driver/hexagon-toolchain-elf.c
index d7c8015547e4..3ae2b56de22f 100644
--- a/clang/test/Driver/hexagon-toolchain-elf.c
+++ b/clang/test/Driver/hexagon-toolchain-elf.c
@@ -484,19 +484,19 @@
 // CHECK041: {{hexagon-link|ld}}
 // CHECK041:  "-G0"
 
-// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as \
+// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as -fno-pie 
-no-pie \
 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
 // RUN:   -mcpu=hexagonv60 \
 // RUN:   -G=8 \
 // RUN:   %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK042 %s
-// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as \
+// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as -fno-pie 
-no-pie \
 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
 // RUN:   -mcpu=hexagonv60 \
 // RUN:   -G 8 \
 // RUN:   %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK042 %s
-// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as \
+// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as -fno-pie 
-no-pie \
 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
 // RUN:   -mcpu=hexagonv60 \
 // RUN:   -msmall-data-threshold=8 \



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 3e10605 - [Driver][test] Remove soon irrelevant pie tests

2022-02-25 Thread Fangrui Song via llvm-branch-commits

Author: Fangrui Song
Date: 2022-02-25T01:30:23-08:00
New Revision: 3e10605abcb297be25ef09eb606ac19c2fc52ea5

URL: 
https://github.com/llvm/llvm-project/commit/3e10605abcb297be25ef09eb606ac19c2fc52ea5
DIFF: 
https://github.com/llvm/llvm-project/commit/3e10605abcb297be25ef09eb606ac19c2fc52ea5.diff

LOG: [Driver][test] Remove soon irrelevant pie tests

CLANG_DEFAULT_PIE_ON_LINUX=on will soon become the default. The purpose
of these tests has gone.

(cherry picked from commit 0ac6be6ab6b564327caeac417fe6d29044c7fe61)

Added: 


Modified: 
clang/test/Driver/fsanitize.c

Removed: 




diff  --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
index 7bcda5c33dc9e..17fce1981eead 100644
--- a/clang/test/Driver/fsanitize.c
+++ b/clang/test/Driver/fsanitize.c
@@ -1,4 +1,3 @@
-// UNSUPPORTED: default-pie-on-linux
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined 
-fsanitize-trap=undefined %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-UNDEFINED-TRAP
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined 
-fsanitize-trap=undefined -fno-sanitize-trap=signed-integer-overflow %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP2
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined 
-fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-UNDEFINED-TRAP
@@ -345,27 +344,6 @@
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr 
-fsanitize=undefined,address %s -### 2>&1
 // OK
 
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-NO-PIE
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-NO-PIE
-// RUN: %clang -target x86_64-unknown-freebsd -fsanitize=memory %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
-// RUN: %clang -target aarch64-linux-gnu -fsanitize=memory %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
-// RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
-// RUN: %clang -target arm-linux-androideabi24 -fsanitize=address %s -### 2>&1 
| FileCheck %s --check-prefix=CHECK-PIE
-// RUN: %clang -target aarch64-linux-android -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-NO-PIE
-// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-NO-PIE
-
-// CHECK-NO-PIE-NOT: "-pie"
-// CHECK-NO-PIE: "-mrelocation-model" "static"
-// CHECK-NO-PIE-NOT: "-pie"
-
-// CHECK-PIC-NO-PIE-NOT: "-pie"
-// CHECK-PIC-NO-PIE: "-mrelocation-model" "pic"
-// CHECK-PIC-NO-PIE-NOT: "-pie"
-
-// CHECK-PIE: "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie"
-// CHECK-PIE: "-pie"
-
 // RUN: %clang -target arm-linux-androideabi %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-ANDROID-NO-ASAN
 // CHECK-ANDROID-NO-ASAN: "-mrelocation-model" "pic"
 



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] bdbca8f - [asan][test] asan_prelink_test.cpp: use -fno-pie -no-pie

2022-02-25 Thread Fangrui Song via llvm-branch-commits

Author: Fangrui Song
Date: 2022-02-25T01:30:45-08:00
New Revision: bdbca8f3d0b272199c595dd55cb3d5d0a233771d

URL: 
https://github.com/llvm/llvm-project/commit/bdbca8f3d0b272199c595dd55cb3d5d0a233771d
DIFF: 
https://github.com/llvm/llvm-project/commit/bdbca8f3d0b272199c595dd55cb3d5d0a233771d.diff

LOG: [asan][test] asan_prelink_test.cpp: use -fno-pie -no-pie

prelink (will be removed by glibc 2.37) does not support PIE.

(cherry picked from commit 611122892e6d5813444bdd0e1fbe0a96f6e09779)

Added: 


Modified: 
compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cpp

Removed: 




diff  --git a/compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cpp 
b/compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cpp
index 9c70b61291b36..2dfe689ddcbbc 100644
--- a/compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cpp
+++ b/compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cpp
@@ -7,7 +7,7 @@
 // RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared %s -o %t.so 
-Wl,-Ttext-segment=0x36 ||\
 // RUN:   %clangxx_asan -DBUILD_SO=1 -fPIC -shared %s -o %t.so 
-Wl,--image-base=0x36 ||\
 // RUN:   %clangxx_asan -DBUILD_SO=1 -fPIC -shared %s -o %t.so 
-Wl,-Ttext=0x36
-// RUN: %clangxx_asan %t.o %t.so -Wl,-R. -o %t
+// RUN: %clangxx_asan -fno-pie -no-pie %t.o %t.so -Wl,-R. -o %t
 // RUN: %env_asan_opts=verbosity=1 %run %t 2>&1 | FileCheck %s
 
 // GNU driver doesn't handle .so files properly.



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 1f7e8b1 - [Docs] Added note about LLDB Win/Arm64 binary release

2022-02-25 Thread Muhammad Omair Javaid via llvm-branch-commits

Author: Muhammad Omair Javaid
Date: 2022-02-25T17:51:46+05:00
New Revision: 1f7e8b1c6893d0c5337441ff3726c64cdf54b618

URL: 
https://github.com/llvm/llvm-project/commit/1f7e8b1c6893d0c5337441ff3726c64cdf54b618
DIFF: 
https://github.com/llvm/llvm-project/commit/1f7e8b1c6893d0c5337441ff3726c64cdf54b618.diff

LOG: [Docs] Added note about LLDB Win/Arm64 binary release

LLDB windows on ARM64 14.0.0 release will include LLDB binary. This
patch adds a release note about it.

Added: 


Modified: 
llvm/docs/ReleaseNotes.rst

Removed: 




diff  --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 1ac4cca463794..c6e6e445f709d 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -252,6 +252,9 @@ Changes to LLDB
 
 * Fixed continuing from breakpoints and singlestepping on Windows on ARM/ARM64.
 
+* LLDB has been included in Windows on ARM64 binary release with Python support
+  disabled.
+
 Changes to Sanitizers
 -
 



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang-tools-extra] e89602b - [clang-tidy] Fix `readability-suspicious-call-argument` crash for arguments without name-like identifier

2022-02-25 Thread via llvm-branch-commits

Author: Whisperity
Date: 2022-02-25T16:30:13+01:00
New Revision: e89602b7b2ec12f20f2618cefb864c2b22d0048a

URL: 
https://github.com/llvm/llvm-project/commit/e89602b7b2ec12f20f2618cefb864c2b22d0048a
DIFF: 
https://github.com/llvm/llvm-project/commit/e89602b7b2ec12f20f2618cefb864c2b22d0048a.diff

LOG: [clang-tidy] Fix `readability-suspicious-call-argument` crash for 
arguments without name-like identifier

As originally reported by @steakhal in
http://github.com/llvm/llvm-project/issues/54074, the name extraction logic of
`readability-suspicious-call-argument` crashes if the argument passed to a
function was a function call to a non-trivially named entity (e.g. an operator).

Fixed this crash case by ignoring such constructs and considering them as having
no name.

Reviewed By: aaron.ballman, steakhal

Differential Revision: http://reviews.llvm.org/D120555

(Cherry-picked from commit 416e689ecda66616da855c82f7ec652657730c6a)

Added: 


Modified: 
clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
clang-tools-extra/docs/ReleaseNotes.rst

clang-tools-extra/test/clang-tidy/checkers/readability-suspicious-call-argument.cpp

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
index 4d7c3451acc7a..ac6bda3ff09ff 100644
--- a/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
@@ -711,23 +711,28 @@ void SuspiciousCallArgumentCheck::setArgNamesAndTypes(
 
   for (std::size_t I = InitialArgIndex, J = MatchedCallExpr->getNumArgs();
I < J; ++I) {
+assert(ArgTypes.size() == I - InitialArgIndex &&
+   ArgNames.size() == ArgTypes.size() &&
+   "Every iteration must put an element into the vectors!");
+
 if (const auto *ArgExpr = dyn_cast(
 MatchedCallExpr->getArg(I)->IgnoreUnlessSpelledInSource())) {
   if (const auto *Var = dyn_cast(ArgExpr->getDecl())) {
 ArgTypes.push_back(Var->getType());
 ArgNames.push_back(Var->getName());
-  } else if (const auto *FCall =
- dyn_cast(ArgExpr->getDecl())) {
-ArgTypes.push_back(FCall->getType());
-ArgNames.push_back(FCall->getName());
-  } else {
-ArgTypes.push_back(QualType());
-ArgNames.push_back(StringRef());
+continue;
+  }
+  if (const auto *FCall = dyn_cast(ArgExpr->getDecl())) {
+if (FCall->getNameInfo().getName().isIdentifier()) {
+  ArgTypes.push_back(FCall->getType());
+  ArgNames.push_back(FCall->getName());
+  continue;
+}
   }
-} else {
-  ArgTypes.push_back(QualType());
-  ArgNames.push_back(StringRef());
 }
+
+ArgTypes.push_back(QualType());
+ArgNames.push_back(StringRef());
   }
 }
 

diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index 59aff131f6c22..a794983708cfc 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -352,6 +352,10 @@ Changes in existing checks
   return statements associated with ``case``, ``default`` and labeled
   statements.
 
+- Fixed a crash in :doc:`readability-suspicious-call-argument
+  ` related to passing
+  arguments that refer to program elements without a trivial identifier.
+
 Removed checks
 ^^
 

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability-suspicious-call-argument.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/readability-suspicious-call-argument.cpp
index 2597ee3b9e030..edd3591517af3 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/readability-suspicious-call-argument.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/readability-suspicious-call-argument.cpp
@@ -485,3 +485,32 @@ int main() {
 
   return 0;
 }
+
+namespace Issue_54074 {
+
+class T {};
+using OperatorTy = int(const T &, const T &);
+int operator-(const T &, const T &);
+
+template 
+struct Wrap {
+  Wrap(U);
+};
+
+template 
+void wrapTaker(V, Wrap);
+
+template 
+void wrapTaker(V a, V b, Wrap);
+
+void test() {
+  wrapTaker(0, operator-);
+  // NO-WARN. No crash!
+
+  int a = 4, b = 8;
+  wrapTaker(b, a, operator-);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 1st argument 'b' (passed to 
'a') looks like it might be swapped with the 2nd, 'a' (passed to 
'b')
+  // CHECK-MESSAGES: :[[@LINE-9]]:6: note: in the call to 'wrapTaker', 
declared here
+}
+
+} // namespace Issue_54074



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] cdd8cca - [ELF] Support some absolute/PC-relative relocation types for REL format

2022-02-25 Thread Fangrui Song via llvm-branch-commits

Author: Fangrui Song
Date: 2022-02-25T19:42:17Z
New Revision: cdd8cca0c33c5392d9247c8aea036bfbb471c971

URL: 
https://github.com/llvm/llvm-project/commit/cdd8cca0c33c5392d9247c8aea036bfbb471c971
DIFF: 
https://github.com/llvm/llvm-project/commit/cdd8cca0c33c5392d9247c8aea036bfbb471c971.diff

LOG: [ELF] Support some absolute/PC-relative relocation types for REL format

ctfconvert seems to use REL-format `.rel.SUNW_dof` for 32-bit architectures.
```
Binary file usr/ports/lang/perl5.32/work/perl-5.32.1/dtrace_mini.o matches
[alfredo.junior@dell-a ~/tmp/llvm-bug]$ readelf -r dtrace_mini.o

Relocation section (.rel.SUNW_dof):
r_offset r_info   r_type  st_value st_name
0184 281a R_PPC_REL32  
$dtrace1772974259.Perl_dtrace_probe_load
```

Support R_PPC_REL32 to fix `ld.lld: error: drti.c:(.SUNW_dof+0x4E4): internal 
linker error: cannot read addend for relocation R_PPC_REL32`.
While here, add some common relocation types for AArch64, PPC, and PPC64.
We perform minimum tests.

Reviewed By: adalava, arichardson

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

(cherry picked from commit 767e64fc11d7734843ec5bb0bd3f7330541bb1a6)

Added: 
lld/test/ELF/relocation-rel-format.test

Modified: 
lld/ELF/Arch/AArch64.cpp
lld/ELF/Arch/PPC.cpp
lld/ELF/Arch/PPC64.cpp

Removed: 




diff  --git a/lld/ELF/Arch/AArch64.cpp b/lld/ELF/Arch/AArch64.cpp
index 9e857d5906845..add819ff5a802 100644
--- a/lld/ELF/Arch/AArch64.cpp
+++ b/lld/ELF/Arch/AArch64.cpp
@@ -199,6 +199,11 @@ int64_t AArch64::getImplicitAddend(const uint8_t *buf, 
RelType type) const {
 return read64(buf + 8);
   case R_AARCH64_NONE:
 return 0;
+  case R_AARCH64_PREL32:
+return SignExtend64<32>(read32(buf));
+  case R_AARCH64_ABS64:
+  case R_AARCH64_PREL64:
+return read64(buf);
   default:
 internalLinkerError(getErrorLocation(buf),
 "cannot read addend for relocation " + toString(type));

diff  --git a/lld/ELF/Arch/PPC.cpp b/lld/ELF/Arch/PPC.cpp
index 315ac7df608d0..47c31e3a3b943 100644
--- a/lld/ELF/Arch/PPC.cpp
+++ b/lld/ELF/Arch/PPC.cpp
@@ -280,6 +280,9 @@ int64_t PPC::getImplicitAddend(const uint8_t *buf, RelType 
type) const {
   switch (type) {
   case R_PPC_NONE:
 return 0;
+  case R_PPC_ADDR32:
+  case R_PPC_REL32:
+return SignExtend64<32>(read32(buf));
   default:
 internalLinkerError(getErrorLocation(buf),
 "cannot read addend for relocation " + toString(type));

diff  --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp
index 7d051c43af0d3..871e19262ae77 100644
--- a/lld/ELF/Arch/PPC64.cpp
+++ b/lld/ELF/Arch/PPC64.cpp
@@ -1064,6 +1064,11 @@ int64_t PPC64::getImplicitAddend(const uint8_t *buf, 
RelType type) const {
   switch (type) {
   case R_PPC64_NONE:
 return 0;
+  case R_PPC64_REL32:
+return SignExtend64<32>(read32(buf));
+  case R_PPC64_ADDR64:
+  case R_PPC64_REL64:
+return read64(buf);
   default:
 internalLinkerError(getErrorLocation(buf),
 "cannot read addend for relocation " + toString(type));

diff  --git a/lld/test/ELF/relocation-rel-format.test 
b/lld/test/ELF/relocation-rel-format.test
new file mode 100644
index 0..df38f8f7daf15
--- /dev/null
+++ b/lld/test/ELF/relocation-rel-format.test
@@ -0,0 +1,42 @@
+## Test some relocation types for REL format.
+# RUN: yaml2obj -DMACHINE=AARCH64 -DR0=R_AARCH64_ABS64 -DR1=R_AARCH64_PREL32 
-DR2=R_AARCH64_PREL64 %s -o %t.o
+# RUN: ld.lld %t.o -o /dev/null
+# RUN: yaml2obj -DMACHINE=PPC -DBITS=32 -DR0=R_PPC_ADDR32 -DR1=R_PPC_REL32 %s 
-o %t.o
+# RUN: ld.lld %t.o -o /dev/null
+# RUN: yaml2obj -DMACHINE=PPC64 -DR0=R_PPC64_ADDR64 -DR1=R_PPC64_REL32 
-DR2=R_PPC64_REL64 %s -o %t.o
+# RUN: ld.lld %t.o -o /dev/null
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS[[BITS=64]]
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_[[MACHINE]]
+Sections:
+  - Name:  .text
+Type:  SHT_PROGBITS
+Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+Size:  24
+  - Name:  .data
+Type:  SHT_PROGBITS
+Flags: [ SHF_WRITE, SHF_ALLOC ]
+  - Name:  .rel.text
+Type:  SHT_REL
+Info:  .text
+Relocations:
+  - Symbol: .data
+Type:   [[R0]]
+  - Offset: 8
+Symbol: .data
+Type:   [[R1=0]]
+  - Offset: 16
+Symbol: .data
+Type:   [[R2=0]]
+Symbols:
+  - Name:.data
+Type:STT_SECTION
+Section: .data
+  - Name:_start
+Section: .text
+Binding: STB_GLOBAL
+...



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] df3182a - [clang] [test] Skip hip-fpie-option.hip if default-pie

2022-02-25 Thread Michał Górny via llvm-branch-commits

Author: Michał Górny
Date: 2022-02-25T21:02:00+01:00
New Revision: df3182a7df1913f8503fda9bb4553297f0b8571b

URL: 
https://github.com/llvm/llvm-project/commit/df3182a7df1913f8503fda9bb4553297f0b8571b
DIFF: 
https://github.com/llvm/llvm-project/commit/df3182a7df1913f8503fda9bb4553297f0b8571b.diff

LOG: [clang] [test] Skip hip-fpie-option.hip if default-pie

Skip the hip-fpie-option.hip Driver test if default-pie-on-linux
is used.  This test currently relies on default-no-pie, and it has been
changed to require default-pie in main.

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

Added: 


Modified: 
clang/test/Driver/hip-fpie-option.hip

Removed: 




diff  --git a/clang/test/Driver/hip-fpie-option.hip 
b/clang/test/Driver/hip-fpie-option.hip
index 2e296a099dea..69a2954f6a90 100644
--- a/clang/test/Driver/hip-fpie-option.hip
+++ b/clang/test/Driver/hip-fpie-option.hip
@@ -1,4 +1,5 @@
 // REQUIRES: clang-driver, amdgpu-registered-target
+// UNSUPPORTED: default-pie-on-linux
 
 // -fPIC and -fPIE only affects host relocation model.
 // device compilation always uses PIC. 



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libunwind] 8400036 - [libunwind][test] remember_state_leak.pass.sh.s: link with -no-pie

2022-02-25 Thread Fangrui Song via llvm-branch-commits

Author: Fangrui Song
Date: 2022-02-25T20:31:02Z
New Revision: 8400036358c8c8a6f2c68476cce9eb6a712c

URL: 
https://github.com/llvm/llvm-project/commit/8400036358c8c8a6f2c68476cce9eb6a712c
DIFF: 
https://github.com/llvm/llvm-project/commit/8400036358c8c8a6f2c68476cce9eb6a712c.diff

LOG: [libunwind][test] remember_state_leak.pass.sh.s: link with -no-pie

The no-pic large code model style `movabsq $callback, %rsi` does not work with 
-pie.

(cherry picked from commit 84647ff38ca76136e3c4be80cf6785a78188d33a)

Added: 


Modified: 
libunwind/test/remember_state_leak.pass.sh.s

Removed: 




diff  --git a/libunwind/test/remember_state_leak.pass.sh.s 
b/libunwind/test/remember_state_leak.pass.sh.s
index f18d1768e7c4b..590653e2b10de 100644
--- a/libunwind/test/remember_state_leak.pass.sh.s
+++ b/libunwind/test/remember_state_leak.pass.sh.s
@@ -1,5 +1,5 @@
 # REQUIRES: target={{x86_64-.+-linux-gnu}}
-# RUN: %{build}
+# RUN: %{build} -no-pie
 # RUN: %{run}
 
 # The following assembly is a translation of this code:



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] f8ca5fa - [ELF][X86] Don't create IBT .plt if there is no PLT entry

2022-02-25 Thread Fangrui Song via llvm-branch-commits

Author: Joao Moreira
Date: 2022-02-26T03:56:09Z
New Revision: f8ca5fabdb54fdf64b3dffb38ebf7d0220f415a2

URL: 
https://github.com/llvm/llvm-project/commit/f8ca5fabdb54fdf64b3dffb38ebf7d0220f415a2
DIFF: 
https://github.com/llvm/llvm-project/commit/f8ca5fabdb54fdf64b3dffb38ebf7d0220f415a2.diff

LOG: [ELF][X86] Don't create IBT .plt if there is no PLT entry

https://github.com/ClangBuiltLinux/linux/issues/1606
When GNU_PROPERTY_X86_FEATURE_1_IBT is enabled, ld.lld will create .plt output
section even if there is no PLT entry. Fix this by implementing
IBTPltSection::isNeeded instead of using the default code path (which always
returns true).

Reviewed By: MaskRay

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

(cherry picked from commit 9d7001eba9c4cb311e03cd8cdc231f9e579f2d0f)

Added: 


Modified: 
lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h
lld/test/ELF/format-binary.test
lld/test/ELF/x86-64-feature-cet.s

Removed: 




diff  --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index ccf0c5fd65da2..7778ae5f78e66 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -2699,6 +2699,8 @@ size_t IBTPltSection::getSize() const {
   return 16 + in.plt->getNumEntries() * target->pltEntrySize;
 }
 
+bool IBTPltSection::isNeeded() const { return in.plt->getNumEntries() > 0; }
+
 // The string hash function for .gdb_index.
 static uint32_t computeGdbHash(StringRef s) {
   uint32_t h = 0;

diff  --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index 1b63a5d29d106..e609b3d7982a5 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -762,6 +762,7 @@ class IBTPltSection : public SyntheticSection {
 public:
   IBTPltSection();
   void writeTo(uint8_t *Buf) override;
+  bool isNeeded() const override;
   size_t getSize() const override;
 };
 

diff  --git a/lld/test/ELF/format-binary.test b/lld/test/ELF/format-binary.test
index bb06d7e5ab9f2..3c580ebb99ed4 100644
--- a/lld/test/ELF/format-binary.test
+++ b/lld/test/ELF/format-binary.test
@@ -31,10 +31,10 @@
 
 # EXE:  Machine: Advanced Micro Devices X86-64
 # EXE:  [Nr] Name Type Address  OffSize   ES Flg 
Lk Inf Al
-# EXE:  [ 3] .dataPROGBITS {{.*}}  0c 00  WA  
0   0  8
+# EXE:  [ 2] .dataPROGBITS {{.*}}  0c 00  WA  
0   0  8
 # EXE:  Size TypeBind   Vis  Ndx Name
-# EXE: 0 OBJECT  GLOBAL DEFAULT3 _binary_d_t_txt_start
-# EXE-NEXT:0 OBJECT  GLOBAL DEFAULT3 _binary_d_t_txt_end
+# EXE: 0 OBJECT  GLOBAL DEFAULT2 _binary_d_t_txt_start
+# EXE-NEXT:0 OBJECT  GLOBAL DEFAULT2 _binary_d_t_txt_end
 # EXE-NEXT:0 OBJECT  GLOBAL DEFAULT  ABS _binary_d_t_txt_size
 
 # RUN: not ld.lld -b foo 2>&1 | FileCheck --check-prefix=ERR %s

diff  --git a/lld/test/ELF/x86-64-feature-cet.s 
b/lld/test/ELF/x86-64-feature-cet.s
index 5322bbdf3f383..cf90d9708e119 100644
--- a/lld/test/ELF/x86-64-feature-cet.s
+++ b/lld/test/ELF/x86-64-feature-cet.s
@@ -91,6 +91,17 @@
 # DISASM-NEXT:   jmpq*0x2126(%rip)
 # DISASM-NEXT:   nopw(%rax,%rax)
 
+## If there is no PLT entry, don't create .plt section.
+# RUN: ld.lld -e 0 %t1.o -o %t.noplt
+# RUN: llvm-readelf -S %t.noplt | FileCheck %s --check-prefix=NOPLT
+# RUN: ld.lld -r %t1.o -o %t.noplt
+# RUN: llvm-readelf -S %t.noplt | FileCheck %s --check-prefix=NOPLT
+
+# NOPLT: [Nr] Name
+# NOPLT-NOT: .plt
+# NOPLT: .note.gnu.property
+# NOPLT-NOT: .plt
+
 .section ".note.gnu.property", "a"
 .long 4
 .long 0x10



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits