new file mode 100644
@@ -0,0 +1,9 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute Tag_Feature_BTI, 1
+
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ bl foo
+ bl bar
\ No newline at end of file
new file mode 100644
@@ -0,0 +1,14 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute Tag_Feature_BTI, 1
+
+ .text
+ .globl foo2
+ .type foo2,@function
+foo2:
+ bl foo_2
+
+.ifdef __split_gnu_properties__
+.include "gnu-note-properties-selectable-split.inc"
+.else
+.include "gnu-note-properties-selectable-merged.inc"
+.endif
new file mode 100644
@@ -0,0 +1,53 @@
+# name: EABI build attributes: some files missing Tag_Feature_BTI, but -z force-bti generates PLT with BTI.
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-bti-via-gnu-props.s
+# source: ba-aarch64-1-bti-2.s
+# as: -defsym __property_bti__=1
+# ld: -shared -T bti-plt.ld -z force-bti -z bti-report=warning
+#warning: \A[^\n]*ba-aarch64-1-void\.o: warning: BTI is required by -z force-bti, but this input object file lacks the necessary property note\.
+# objdump: -dr -j .plt
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
+
+[0-9a-f]+ <\.plt>:
+.*: d503245f bti c
+.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9400e11 ldr x17, \[x16, #24\]
+.*: 91006210 add x16, x16, #0x18
+.*: d61f0220 br x17
+.*: d503201f nop
+.*: d503201f nop
+
+[0-9a-f]+ <foo_1@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401211 ldr x17, \[x16, #32\]
+.*: 91008210 add x16, x16, #0x20
+.*: d61f0220 br x17
+
+[0-9a-f]+ <foo_2@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401611 ldr x17, \[x16, #40\]
+.*: 9100a210 add x16, x16, #0x28
+.*: d61f0220 br x17
+
+[0-9a-f]+ <foo@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401a11 ldr x17, \[x16, #48\]
+.*: 9100c210 add x16, x16, #0x30
+.*: d61f0220 br x17
+
+[0-9a-f]+ <bar@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401e11 ldr x17, \[x16, #56\]
+.*: 9100e210 add x16, x16, #0x38
+.*: d61f0220 br x17
+
+[0-9a-f]+ <foo_3@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9402211 ldr x17, \[x16, #64\]
+.*: 91010210 add x16, x16, #0x40
+.*: d61f0220 br x17
new file mode 100644
@@ -0,0 +1,24 @@
+# name: EABI build attributes: some files missing Tag_Feature_BTI, but -z force-bti means that the output has Tag_Feature_BTI=0x1
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-bti-via-gnu-props.s
+# source: ba-aarch64-1-bti-2.s
+# as: -defsym __property_bti__=1
+# ld: -shared -T bti-plt.ld -z force-bti -z bti-report=warning
+#warning: .*ba-aarch64-1-void\.o: warning: BTI is required by -z force-bti.*
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: BTI
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 35
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_BTI: 1 \(0x1\)
+ Tag_Feature_PAC: 0 \(0x0\)
+ Tag_Feature_GCS: 0 \(0x0\)
new file mode 100644
@@ -0,0 +1,19 @@
+# name: EABI build attributes: a input object without build attributes or GNU properties, but -z force-bti means that the output has Tag_Feature_BTI=0x1
+# source: ba-aarch64-1-void.s
+# as:
+# ld: -shared -T bti-plt.ld -z force-bti -z bti-report=warning
+#warning: .*ba-aarch64-1-void\.o: warning: BTI is required by -z force-bti.*
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: BTI
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 31
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_BTI: 1 \(0x1\)
new file mode 100644
@@ -0,0 +1,20 @@
+# name: EABI build attributes: all files with BTI GNU property means that output also has Tag_Feature_BTI=0x1
+# source: ba-aarch64-1-bti-via-gnu-props.s
+# as: -defsym __property_bti__=1
+# ld: -shared -T bti-plt.ld
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: BTI
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 35
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_BTI: 1 \(0x1\)
+ Tag_Feature_PAC: 0 \(0x0\)
+ Tag_Feature_GCS: 0 \(0x0\)
new file mode 100644
@@ -0,0 +1,45 @@
+# name: EABI build attributes: some files missing Tag_Feature_BTI does not trigger generation of PLT with BTI.
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-bti-2.s
+# as:
+# ld: -shared -T bti-plt.ld
+# objdump: -dr -j .plt
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
+
+[0-9a-f]+ <\.plt>:
+.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9400e11 ldr x17, \[x16, #24\]
+.*: 91006210 add x16, x16, #0x18
+.*: d61f0220 br x17
+.*: d503201f nop
+.*: d503201f nop
+.*: d503201f nop
+
+[0-9a-f]+ <foo_1@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401211 ldr x17, \[x16, #32\]
+.*: 91008210 add x16, x16, #0x20
+.*: d61f0220 br x17
+
+[0-9a-f]+ <foo_2@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401611 ldr x17, \[x16, #40\]
+.*: 9100a210 add x16, x16, #0x28
+.*: d61f0220 br x17
+
+[0-9a-f]+ <foo@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401a11 ldr x17, \[x16, #48\]
+.*: 9100c210 add x16, x16, #0x30
+.*: d61f0220 br x17
+
+[0-9a-f]+ <bar@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401e11 ldr x17, \[x16, #56\]
+.*: 9100e210 add x16, x16, #0x38
+.*: d61f0220 br x17
new file mode 100644
@@ -0,0 +1,16 @@
+# name: EABI build attributes: some files missing Tag_Feature_BTI means that the output has Tag_Feature_BTI=0x0
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-bti-2.s
+# as:
+# ld: -shared -T bti-plt.ld
+# readelf: --arch-specific --notes
+
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 31
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_BTI: 0 \(0x0\)
new file mode 100644
@@ -0,0 +1,38 @@
+# name: EABI build attributes: all files with Tag_Feature_BTI=0x1 generates PLT with BTI.
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-bti-2.s
+# as:
+# ld: -shared -T bti-plt.ld
+# objdump: -dr -j .plt
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
+
+[0-9a-f]+ <\.plt>:
+.*: d503245f bti c
+.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9400e11 ldr x17, \[x16, #24\]
+.*: 91006210 add x16, x16, #0x18
+.*: d61f0220 br x17
+.*: d503201f nop
+.*: d503201f nop
+
+[0-9a-f]+ <foo_2@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401211 ldr x17, \[x16, #32\]
+.*: 91008210 add x16, x16, #0x20
+.*: d61f0220 br x17
+
+[0-9a-f]+ <foo@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401611 ldr x17, \[x16, #40\]
+.*: 9100a210 add x16, x16, #0x28
+.*: d61f0220 br x17
+
+[0-9a-f]+ <bar@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401a11 ldr x17, \[x16, #48\]
+.*: 9100c210 add x16, x16, #0x30
+.*: d61f0220 br x17
new file mode 100644
@@ -0,0 +1,19 @@
+# name: EABI build attributes: all files with Tag_Feature_BTI=0x1 means that output also has Tag_Feature_BTI=0x1
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-bti-2.s
+# as:
+# ld: -shared -T bti-plt.ld
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: BTI
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 31
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_BTI: 1 \(0x1\)
new file mode 100644
@@ -0,0 +1,11 @@
+ .text
+ .globl foo3
+ .type foo3,@function
+foo3:
+ bl foo_3
+
+.ifdef __split_gnu_properties__
+.include "gnu-note-properties-selectable-split.inc"
+.else
+.include "gnu-note-properties-selectable-merged.inc"
+.endif
new file mode 100644
@@ -0,0 +1,22 @@
+# name: EABI build attributes: EABI build attributes: some files with build attribute Tag_Feature_BTI=0x1 and others with equivalent GNU property means that output also has Tag_Feature_BTI=0x1
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-bti-via-gnu-props.s
+# source: ba-aarch64-1-bti-2.s
+# as: -defsym __property_bti__=1
+# ld: -shared -T bti-plt.ld
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: BTI
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 35
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_BTI: 1 \(0x1\)
+ Tag_Feature_PAC: 0 \(0x0\)
+ Tag_Feature_GCS: 0 \(0x0\)
new file mode 100644
@@ -0,0 +1,9 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute Tag_Feature_GCS, 1
+
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ bl foo
+ bl bar
\ No newline at end of file
new file mode 100644
@@ -0,0 +1,14 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute Tag_Feature_GCS, 1
+
+ .text
+ .globl foo2
+ .type foo2,@function
+foo2:
+ bl foo_2
+
+.ifdef __split_gnu_properties__
+.include "gnu-note-properties-selectable-split.inc"
+.else
+.include "gnu-note-properties-selectable-merged.inc"
+.endif
new file mode 100644
@@ -0,0 +1,24 @@
+# name: EABI build attributes: some files missing Tag_Feature_GCS, but -z gcs=always means that GCS is required.
+# source: ba-aarch64-1-gcs-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-gcs-via-gnu-props.s
+# source: ba-aarch64-1-gcs-2.s
+# as: -defsym __property_gcs__=1
+# ld: -shared -z gcs=always -z gcs-report=warning
+#warning: .*ba-aarch64-1-void\.o: warning: GCS is required by -z gcs.*
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: GCS
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 35
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_BTI: 0 \(0x0\)
+ Tag_Feature_PAC: 0 \(0x0\)
+ Tag_Feature_GCS: 1 \(0x1\)
new file mode 100644
@@ -0,0 +1,20 @@
+# name: EABI build attributes: all files with GCS GNU property means that output also has Tag_Feature_GCS=0x1
+# source: ba-aarch64-1-gcs-via-gnu-props.s
+# as: -defsym __property_gcs__=1
+# ld: -shared
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: GCS
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 35
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_BTI: 0 \(0x0\)
+ Tag_Feature_PAC: 0 \(0x0\)
+ Tag_Feature_GCS: 1 \(0x1\)
new file mode 100644
@@ -0,0 +1,16 @@
+# name: EABI build attributes: some files missing Tag_Feature_GCS means that the output has Tag_Feature_GCS=0x0
+# source: ba-aarch64-1-gcs-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-gcs-2.s
+# as:
+# ld: -shared -z gcs=implicit -z gcs-report=warning
+# readelf: --arch-specific --notes
+
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 31
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_GCS: 0 \(0x0\)
new file mode 100644
@@ -0,0 +1,19 @@
+# name: EABI build attributes: all files with Tag_Feature_GCS=0x1 means that output also has Tag_Feature_GCS=0x1
+# source: ba-aarch64-1-gcs-1.s
+# source: ba-aarch64-1-gcs-2.s
+# as:
+# ld: -shared
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: GCS
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 31
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_GCS: 1 \(0x1\)
new file mode 100644
@@ -0,0 +1,11 @@
+ .text
+ .globl foo3
+ .type foo3,@function
+foo3:
+ bl foo_3
+
+.ifdef __split_gnu_properties__
+.include "gnu-note-properties-selectable-split.inc"
+.else
+.include "gnu-note-properties-selectable-merged.inc"
+.endif
new file mode 100644
@@ -0,0 +1,2 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute Tag_Feature_BTI, 0
new file mode 100644
@@ -0,0 +1,2 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute Tag_Feature_GCS, 0
new file mode 100644
@@ -0,0 +1,9 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute Tag_Feature_PAC, 1
+
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ bl foo
+ bl bar
\ No newline at end of file
new file mode 100644
@@ -0,0 +1,14 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute Tag_Feature_PAC, 1
+
+ .text
+ .globl foo2
+ .type foo2,@function
+foo2:
+ bl foo_2
+
+.ifdef __split_gnu_properties__
+.include "gnu-note-properties-selectable-split.inc"
+.else
+.include "gnu-note-properties-selectable-merged.inc"
+.endif
new file mode 100644
@@ -0,0 +1,44 @@
+# name: EABI build attributes: all files with Tag_Feature_PAC=0x1 and '-z pac-plt' does generate PLT with PAC.
+# source: ba-aarch64-1-pac-1.s
+# source: ba-aarch64-1-pac-2.s
+# as: -defsym __property_pac__=1
+# ld: -shared -T bti-plt.ld -z pac-plt
+# objdump: -dr -j .plt
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
+
+[0-9a-f]+ <\.plt>:
+.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9400e11 ldr x17, \[x16, #24\]
+.*: 91006210 add x16, x16, #0x18
+.*: d61f0220 br x17
+.*: d503201f nop
+.*: d503201f nop
+.*: d503201f nop
+
+[0-9a-f]+ <foo_2@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401211 ldr x17, \[x16, #32\]
+.*: 91008210 add x16, x16, #0x20
+.*: d503219f autia1716
+.*: d61f0220 br x17
+.*: d503201f nop
+
+[0-9a-f]+ <foo@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401611 ldr x17, \[x16, #40\]
+.*: 9100a210 add x16, x16, #0x28
+.*: d503219f autia1716
+.*: d61f0220 br x17
+.*: d503201f nop
+
+[0-9a-f]+ <bar@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401a11 ldr x17, \[x16, #48\]
+.*: 9100c210 add x16, x16, #0x30
+.*: d503219f autia1716
+.*: d61f0220 br x17
+.*: d503201f nop
new file mode 100644
@@ -0,0 +1,21 @@
+# name: EABI build attributes: all files with Tag_Feature_PAC=0x1 and '-z pac-plt' means that output has Tag_Feature_PAC=0x1
+# source: ba-aarch64-1-pac-1.s
+# source: ba-aarch64-1-pac-2.s
+# as: -defsym __property_pac__=1
+# ld: -shared -T bti-plt.ld -z pac-plt
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: PAC
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 35
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_BTI: 0 \(0x0\)
+ Tag_Feature_PAC: 1 \(0x1\)
+ Tag_Feature_GCS: 0 \(0x0\)
new file mode 100644
@@ -0,0 +1,38 @@
+# name: EABI build attributes: all files with Tag_Feature_PAC=0x1 but no '-z pac-plt' does not generate PLT with PAC.
+# source: ba-aarch64-1-pac-1.s
+# source: ba-aarch64-1-pac-2.s
+# as: -defsym __property_pac__=1
+# ld: -shared -T bti-plt.ld
+# objdump: -dr -j .plt
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
+
+[0-9a-f]+ <\.plt>:
+.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9400e11 ldr x17, \[x16, #24\]
+.*: 91006210 add x16, x16, #0x18
+.*: d61f0220 br x17
+.*: d503201f nop
+.*: d503201f nop
+.*: d503201f nop
+
+[0-9a-f]+ <foo_2@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401211 ldr x17, \[x16, #32\]
+.*: 91008210 add x16, x16, #0x20
+.*: d61f0220 br x17
+
+[0-9a-f]+ <foo@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401611 ldr x17, \[x16, #40\]
+.*: 9100a210 add x16, x16, #0x28
+.*: d61f0220 br x17
+
+[0-9a-f]+ <bar@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401a11 ldr x17, \[x16, #48\]
+.*: 9100c210 add x16, x16, #0x30
+.*: d61f0220 br x17
new file mode 100644
@@ -0,0 +1,21 @@
+# name: EABI build attributes: all files with Tag_Feature_PAC=0x1 but no '-z pac-plt' means that output has Tag_Feature_PAC=0x1
+# source: ba-aarch64-1-pac-1.s
+# source: ba-aarch64-1-pac-2.s
+# as: -defsym __property_pac__=1
+# ld: -shared -T bti-plt.ld
+# readelf: --arch-specific --notes
+
+Displaying notes found in: \.note\.gnu\.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: PAC
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 35
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_BTI: 0 \(0x0\)
+ Tag_Feature_PAC: 1 \(0x1\)
+ Tag_Feature_GCS: 0 \(0x0\)
new file mode 100644
@@ -0,0 +1,53 @@
+# name: EABI build attributes: '-z pac-plt' with some files without Tag_Feature_PAC=0x1 generates PLT with PAC.
+# source: ba-aarch64-1-pac-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-pac-2.s
+# as: -defsym __property_pac__=1
+# ld: -shared -T bti-plt.ld -z pac-plt
+# objdump: -dr -j .plt
+
+[^:]*: *file format elf64-.*aarch64
+
+Disassembly of section \.plt:
+
+[0-9a-f]+ <\.plt>:
+.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9400e11 ldr x17, \[x16, #24\]
+.*: 91006210 add x16, x16, #0x18
+.*: d61f0220 br x17
+.*: d503201f nop
+.*: d503201f nop
+.*: d503201f nop
+
+[0-9a-f]+ <foo_1@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401211 ldr x17, \[x16, #32\]
+.*: 91008210 add x16, x16, #0x20
+.*: d503219f autia1716
+.*: d61f0220 br x17
+.*: d503201f nop
+
+[0-9a-f]+ <foo_2@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401611 ldr x17, \[x16, #40\]
+.*: 9100a210 add x16, x16, #0x28
+.*: d503219f autia1716
+.*: d61f0220 br x17
+.*: d503201f nop
+
+[0-9a-f]+ <foo@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401a11 ldr x17, \[x16, #48\]
+.*: 9100c210 add x16, x16, #0x30
+.*: d503219f autia1716
+.*: d61f0220 br x17
+.*: d503201f nop
+
+[0-9a-f]+ <bar@plt>:
+.*: 90000090 adrp x16, 28000 <_GLOBAL_OFFSET_TABLE_>
+.*: f9401e11 ldr x17, \[x16, #56\]
+.*: 9100e210 add x16, x16, #0x38
+.*: d503219f autia1716
+.*: d61f0220 br x17
+.*: d503201f nop
new file mode 100644
@@ -0,0 +1,18 @@
+# name: EABI build attributes: '-z pac-plt' with some files without Tag_Feature_PAC=0x1 does not set Tag_Feature_PAC=0x1.
+# source: ba-aarch64-1-pac-1.s
+# source: ba-aarch64-1-void.s
+# source: ba-aarch64-1-pac-2.s
+# as: -defsym __property_pac__=1
+# ld: -shared -T bti-plt.ld -z pac-plt
+# readelf: --arch-specific --notes
+
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 35
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_BTI: 0 \(0x0\)
+ Tag_Feature_PAC: 0 \(0x0\)
+ Tag_Feature_GCS: 0 \(0x0\)
new file mode 100644
@@ -0,0 +1,11 @@
+ .text
+ .globl foo3
+ .type foo3,@function
+foo3:
+ bl foo_3
+
+.ifdef __split_gnu_properties__
+.include "gnu-note-properties-selectable-split.inc"
+.else
+.include "gnu-note-properties-selectable-merged.inc"
+.endif
new file mode 100644
@@ -0,0 +1,7 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute Tag_Feature_BTI, 1
+.aeabi_attribute Tag_Feature_PAC, 1
+
+.aeabi_subsection aeabi_pauthabi, required, uleb128
+.aeabi_attribute Tag_PAuth_Platform, 0xdeadbeef
+.aeabi_attribute Tag_PAuth_Schema, 0x12345678
new file mode 100644
@@ -0,0 +1,7 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute Tag_Feature_BTI, 1
+.aeabi_attribute Tag_Feature_PAC, 0
+
+.aeabi_subsection aeabi_pauthabi, required, uleb128
+.aeabi_attribute Tag_PAuth_Platform, 0xdeadbeef
+.aeabi_attribute Tag_PAuth_Schema, 0x12345678
new file mode 100644
@@ -0,0 +1,7 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute Tag_Feature_BTI, 1
+.aeabi_attribute Tag_Feature_PAC, 1
+
+.aeabi_subsection aeabi_pauthabi, required, uleb128
+.aeabi_attribute Tag_PAuth_Platform, 0x00000001
+.aeabi_attribute Tag_PAuth_Schema, 0x12345678
new file mode 100644
@@ -0,0 +1,7 @@
+.aeabi_subsection aeabi_feature_and_bits, required, uleb128
+.aeabi_attribute Tag_Feature_BTI, 1
+.aeabi_attribute Tag_Feature_PAC, 1
+
+.aeabi_subsection aeabi_pauthabi, optional, ntbs
+.aeabi_attribute Tag_PAuth_Platform, "hello"
+.aeabi_attribute Tag_PAuth_Schema, "world"
new file mode 100644
@@ -0,0 +1,7 @@
+# name: EABI build attributes: combine non-matching aeabi_pauthabi subsections
+# source: ba-aarch64-1-required-subsection-1.s
+# source: ba-aarch64-1-required-subsection-mismatch-1.s
+# source: ba-aarch64-1-required-subsection-2.s
+# as:
+# ld: -shared
+#error: \A[^\n]*ba-aarch64-1-required-subsection-1\.o, [^:]*ba-aarch64-1-required-subsection-mismatch-1\.o: error: mismatching values 0xdeadbeef and 0x1 for required object attribute 'Tag_PAuth_Platform' in subsection 'aeabi_pauthabi'
new file mode 100644
@@ -0,0 +1,9 @@
+# name: EABI build attributes: subsections have different properties from the expected ones
+# source: ba-aarch64-1-required-subsection-1.s
+# source: ba-aarch64-1-required-subsection-mismatch-2.s
+# source: ba-aarch64-1-required-subsection-2.s
+# as:
+# ld: -shared
+#error: \A[^\n]*ba-aarch64-1-required-subsection-mismatch-2\.o: error: optional property of subsection 'aeabi_feature_and_bits' was incorrectly set. Got 'required', expected 'optional'\.\n
+#error: [^\n]*ba-aarch64-1-required-subsection-mismatch-2\.o: error: encoding property of subsection 'aeabi_pauthabi' was incorrectly set\. Got 'ntbs', expected 'uleb128'\.\n
+#error: [^\n]*ba-aarch64-1-required-subsection-mismatch-2\.o: error: optional property of subsection 'aeabi_pauthabi' was incorrectly set\. Got 'optional', expected 'required'\.
\ No newline at end of file
new file mode 100644
@@ -0,0 +1,25 @@
+# name: EABI build attributes: combine matching aeabi_pauthabi subsections
+# source: ba-aarch64-1-required-subsection-1.s
+# source: ba-aarch64-1-required-subsection-2.s
+# as:
+# ld: -shared
+# readelf: --arch-specific
+
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 33
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_BTI: 1 \(0x1\)
+ Tag_Feature_PAC: 0 \(0x0\)
+
+ - Name: aeabi_pauthabi
+ Scope: public
+ Length: 33
+ Optional: False
+ Encoding: ULEB128
+ Values:
+ Tag_PAuth_Platform: 3735928559 \(0xdeadbeef\)
+ Tag_PAuth_Schema: 305419896 \(0x12345678\)
new file mode 100644
@@ -0,0 +1,20 @@
+# name: EABI build attributes: some files missing Tag_Feature_BTI, but -z force-bti means that the output has Tag_Feature_BTI=0x1
+# source: ba-aarch64-1-bti-1.s
+# source: ba-aarch64-1-unknown-tag.s
+# source: ba-aarch64-1-bti-via-gnu-props.s
+# source: ba-aarch64-1-bti-2.s
+# as: -defsym __property_bti__=1
+# ld: -shared -T bti-plt.ld
+#warning: \A[^\n]*ba-aarch64-1-unknown-tag\.o: warning: cannot merge unknown tag Tag_unknown_4 \(=0x1\) in subsection 'aeabi_feature_and_bits'\.
+# readelf: --arch-specific
+
+Subsections:
+ - Name: aeabi_feature_and_bits
+ Scope: public
+ Length: 35
+ Optional: True
+ Encoding: ULEB128
+ Values:
+ Tag_Feature_BTI: 1 \(0x1\)
+ Tag_Feature_PAC: 0 \(0x0\)
+ Tag_Feature_GCS: 0 \(0x0\)
\ No newline at end of file
new file mode 100644
@@ -0,0 +1,3 @@
+.aeabi_subsection aeabi_feature_and_bits, optional, uleb128
+.aeabi_attribute Tag_Feature_BTI, 1
+.aeabi_attribute 4, 1
new file mode 100644
@@ -0,0 +1,5 @@
+ .text
+ .globl foo1
+ .type foo1,@function
+foo1:
+ bl foo_1
new file mode 100644
@@ -0,0 +1,14 @@
+OUTPUT_ARCH(aarch64)
+ENTRY(_start)
+SECTIONS
+{
+ . = 0x10000;
+ .rela.plt : { *(.rela.plt) *(.rela.iplt) }
+ . = 0x18000;
+ .plt : { *(.plt) *(.iplt) }
+ . = 0x20000;
+ .text : { *(.text) }
+ . = 0x28000;
+ .got : { *(.got) *(.got.plt) }
+ .ARM.attributes 0 : { *(.ARM.atttributes) }
+}
new file mode 100644
@@ -0,0 +1,32 @@
+ .set NT_GNU_PROPERTY_TYPE_0, 5
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, (0x1 << 0)
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_PAC, (0x1 << 1)
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_GCS, (0x1 << 2)
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, 0x0
+.ifndef __mask_property_bti__
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_BTI )
+.endif
+.ifndef __mask_property_pac__
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_PAC )
+.endif
+.ifndef __mask_property_gcs__
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_GCS )
+.endif
+.if GNU_PROPERTY_AARCH64_FEATURE_1_VALUE
+ .section ".note.gnu.property", "a"
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long NT_GNU_PROPERTY_TYPE_0 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long GNU_PROPERTY_AARCH64_FEATURE_1_VALUE
+4:
+ .p2align 3
+5:
+.endif
new file mode 100644
@@ -0,0 +1,72 @@
+ .set NT_GNU_PROPERTY_TYPE_0, 5
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, (0x1 << 0)
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_PAC, (0x1 << 1)
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_GCS, (0x1 << 2)
+
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, 0x0
+.ifndef __mask_property_bti__
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_BTI )
+.endif
+.ifndef __mask_property_pac__
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_PAC )
+.endif
+.ifndef __mask_property_gcs__
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_GCS )
+.endif
+
+.if GNU_PROPERTY_AARCH64_FEATURE_1_VALUE
+ .section ".note.gnu.property", "a"
+
+.ifndef __mask_property_bti__
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long NT_GNU_PROPERTY_TYPE_0 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long GNU_PROPERTY_AARCH64_FEATURE_1_BTI
+4:
+ .p2align 3
+5:
+.endif
+
+.ifndef __mask_property_pac__
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long NT_GNU_PROPERTY_TYPE_0 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long GNU_PROPERTY_AARCH64_FEATURE_1_PAC
+4:
+ .p2align 3
+5:
+.endif
+
+.ifndef __mask_property_gcs__
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long NT_GNU_PROPERTY_TYPE_0 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long GNU_PROPERTY_AARCH64_FEATURE_1_GCS
+4:
+ .p2align 3
+5:
+.endif
+
+.endif
new file mode 100644
@@ -0,0 +1,32 @@
+ .set NT_GNU_PROPERTY_TYPE_0, 5
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, (0x1 << 0)
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_PAC, (0x1 << 1)
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_GCS, (0x1 << 2)
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, 0x0
+.ifdef __property_bti__
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_BTI )
+.endif
+.ifdef __property_pac__
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_PAC )
+.endif
+.ifdef __property_gcs__
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_GCS )
+.endif
+.if GNU_PROPERTY_AARCH64_FEATURE_1_VALUE
+ .section ".note.gnu.property", "a"
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long NT_GNU_PROPERTY_TYPE_0 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long GNU_PROPERTY_AARCH64_FEATURE_1_VALUE
+4:
+ .p2align 3
+5:
+.endif
new file mode 100644
@@ -0,0 +1,72 @@
+ .set NT_GNU_PROPERTY_TYPE_0, 5
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, (0x1 << 0)
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_PAC, (0x1 << 1)
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_GCS, (0x1 << 2)
+
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, 0x0
+.ifndef __mask_property_bti__
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_BTI )
+.endif
+.ifndef __mask_property_pac__
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_PAC )
+.endif
+.ifndef __mask_property_gcs__
+ .set GNU_PROPERTY_AARCH64_FEATURE_1_VALUE, ( GNU_PROPERTY_AARCH64_FEATURE_1_VALUE | GNU_PROPERTY_AARCH64_FEATURE_1_GCS )
+.endif
+
+.if GNU_PROPERTY_AARCH64_FEATURE_1_VALUE
+ .section ".note.gnu.property", "a"
+
+.ifdef __property_bti__
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long NT_GNU_PROPERTY_TYPE_0 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long GNU_PROPERTY_AARCH64_FEATURE_1_BTI
+4:
+ .p2align 3
+5:
+.endif
+
+.ifdef __property_pac__
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long NT_GNU_PROPERTY_TYPE_0 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long GNU_PROPERTY_AARCH64_FEATURE_1_PAC
+4:
+ .p2align 3
+5:
+.endif
+
+.ifdef __property_gcs__
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long NT_GNU_PROPERTY_TYPE_0 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long GNU_PROPERTY_AARCH64_FEATURE_1_GCS
+4:
+ .p2align 3
+5:
+.endif
+
+.endif