summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2023-05-09 12:33:44 +0530
committerGitHub <noreply@github.com>2023-05-09 12:33:44 +0530
commit02a85bd038546d040efca42a313e44051b078f9c (patch)
treeefd98c1d8e32a7eb1d4b5baad037690370e4aa3d /tests
parent33a01e2e93bfdd0c37649c6f82172644b8315b55 (diff)
parent37f3e2f4b115b166518a208950ecaaef1434830b (diff)
downloadrust-02a85bd038546d040efca42a313e44051b078f9c.tar.gz
Rollup merge of #110304 - cchiw:master, r=davidtwco
Add GNU Property Note Fix #103001 Generates the missing property note: ``` Displaying notes found in: .note.gnu.property Owner Data size Description GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 Properties: x86 feature: IBT ```
Diffstat (limited to 'tests')
-rw-r--r--tests/run-make/branch-protection-check-IBT/Makefile15
-rw-r--r--tests/run-make/branch-protection-check-IBT/main.rs3
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/run-make/branch-protection-check-IBT/Makefile b/tests/run-make/branch-protection-check-IBT/Makefile
new file mode 100644
index 00000000000..cabe951e1c5
--- /dev/null
+++ b/tests/run-make/branch-protection-check-IBT/Makefile
@@ -0,0 +1,15 @@
+# Check for GNU Property Note
+
+include ../tools.mk
+
+# How to run this
+# python3 x.py test --target x86_64-unknown-linux-gnu tests/run-make/branch-protection-check-IBT/
+
+# only-x86_64
+
+all:
+ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86_64)
+ $(RUSTC) --target x86_64-unknown-linux-gnu -Z cf-protection=branch -L$(TMPDIR) -C link-args='-nostartfiles' -C save-temps ./main.rs -o $(TMPDIR)/rsmain
+ readelf -nW $(TMPDIR)/rsmain | $(CGREP) -e ".note.gnu.property"
+endif
+
diff --git a/tests/run-make/branch-protection-check-IBT/main.rs b/tests/run-make/branch-protection-check-IBT/main.rs
new file mode 100644
index 00000000000..ad379d6ea43
--- /dev/null
+++ b/tests/run-make/branch-protection-check-IBT/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+ println!("hello world");
+}