Browse Source
Add Intel Linear Address Masking (LAM) property support. LAM modifies the checking that is applied to 64-bit linear addresses, allowing software to use of the untranslated address bits for metadata. bfd/ * elf-linker-x86.h (elf_x86_cet_report): Renamed to ... (elf_x86_prop_report): This. (elf_linker_x86_params): Add lam_u48, lam_u57, lam_u48_report and lam_u57_report. * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Support GNU_PROPERTY_X86_FEATURE_1_LAM_U48 and GNU_PROPERTY_X86_FEATURE_1_LAM_U57. (_bfd_x86_elf_link_fixup_gnu_properties): Keep LAM features only for 64-bit output. binutils/ * NEWS: Mention LAM_U48 and LAM_U57 support. * elfedit.c (elf_x86_feature): Support lam_u48 and lam_u57. (usage): Add lam_u48 and lam_u57. * readelf.c (decode_x86_feature_1): Support LAM_U48 and LAM_U57. * doc/binutils.texi: Update elfedit with lam_u48 and lam_u57 support. * testsuite/binutils-all/x86-64/lam-u48.d: New file. * testsuite/binutils-all/x86-64/lam-u48.s: Likewise. * testsuite/binutils-all/x86-64/lam-u57.d: Likewise. * testsuite/binutils-all/x86-64/lam-u57.s: Likewise. include/ * elf/common.h (GNU_PROPERTY_X86_FEATURE_1_LAM_U48): New. (GNU_PROPERTY_X86_FEATURE_1_LAM_U57): Likewise. ld/ * NEWS: Mention LAM_U48 and LAM_U57 support. * ld.texi: Document LAM_U48 and LAM_U57 support. * emulparams/cet.sh: Updated. * emulparams/elf_x86_64.sh: Source x86-64-lam.sh. * emulparams/x86-64-lam.sh: New file. * testsuite/ld-x86-64/property-x86-lam-u48-1a.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48-1b.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48-2.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48-3a.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48-3b.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48-4.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48-5.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u48.s: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-1a.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-1b.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-2.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-3a.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-3b.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-4.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57-5.d: Likewise. * testsuite/ld-x86-64/property-x86-lam-u57.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run LAM tests.binutils-2_36-branch
37 changed files with 609 additions and 37 deletions
@ -0,0 +1,12 @@ |
|||
#PROG: objcopy |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#objcopy: |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 feature: LAM_U48 |
|||
GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 ISA used: |
|||
x86 feature used: x86 |
|||
@ -0,0 +1,27 @@ |
|||
.section ".note.gnu.property", "a" |
|||
.ifdef __64_bit__ |
|||
.p2align 3 |
|||
.else |
|||
.p2align 2 |
|||
.endif |
|||
.long 1f - 0f /* name length */ |
|||
.long 5f - 2f /* data length */ |
|||
.long 5 /* note type */ |
|||
0: .asciz "GNU" /* vendor name */ |
|||
1: |
|||
.ifdef __64_bit__ |
|||
.p2align 3 |
|||
.else |
|||
.p2align 2 |
|||
.endif |
|||
2: .long 0xc0000002 /* pr_type. */ |
|||
.long 4f - 3f /* pr_datasz. */ |
|||
3: |
|||
.long 0x4 |
|||
4: |
|||
.ifdef __64_bit__ |
|||
.p2align 3 |
|||
.else |
|||
.p2align 2 |
|||
.endif |
|||
5: |
|||
@ -0,0 +1,12 @@ |
|||
#PROG: objcopy |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#objcopy: |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 feature: LAM_U57 |
|||
GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 ISA used: |
|||
x86 feature used: x86 |
|||
@ -0,0 +1,27 @@ |
|||
.section ".note.gnu.property", "a" |
|||
.ifdef __64_bit__ |
|||
.p2align 3 |
|||
.else |
|||
.p2align 2 |
|||
.endif |
|||
.long 1f - 0f /* name length */ |
|||
.long 5f - 2f /* data length */ |
|||
.long 5 /* note type */ |
|||
0: .asciz "GNU" /* vendor name */ |
|||
1: |
|||
.ifdef __64_bit__ |
|||
.p2align 3 |
|||
.else |
|||
.p2align 2 |
|||
.endif |
|||
2: .long 0xc0000002 /* pr_type. */ |
|||
.long 4f - 3f /* pr_datasz. */ |
|||
3: |
|||
.long 0x8 |
|||
4: |
|||
.ifdef __64_bit__ |
|||
.p2align 3 |
|||
.else |
|||
.p2align 2 |
|||
.endif |
|||
5: |
|||
@ -0,0 +1,69 @@ |
|||
PARSE_AND_LIST_OPTIONS_LAM=' |
|||
fprintf (file, _("\ |
|||
-z lam-u48 Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U48\n")); |
|||
fprintf (file, _("\ |
|||
-z lam-u48-report=[none|warning|error] (default: none)\n\ |
|||
Report missing LAM_U48 property\n")); |
|||
fprintf (file, _("\ |
|||
-z lam-u57 Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U57\n")); |
|||
fprintf (file, _("\ |
|||
-z lam-u57-report=[none|warning|error] (default: none)\n\ |
|||
Report missing LAM_U57 property\n")); |
|||
fprintf (file, _("\ |
|||
-z lam-report=[none|warning|error] (default: none)\n\ |
|||
Report missing LAM_U48 and LAM_U57 properties\n")); |
|||
' |
|||
PARSE_AND_LIST_ARGS_CASE_Z_LAM=' |
|||
else if (strcmp (optarg, "lam-u48") == 0) |
|||
params.lam_u48 = TRUE; |
|||
else if (strncmp (optarg, "lam-u48-report=", 15) == 0) |
|||
{ |
|||
if (strcmp (optarg + 15, "none") == 0) |
|||
params.lam_u48_report = prop_report_none; |
|||
else if (strcmp (optarg + 15, "warning") == 0) |
|||
params.lam_u48_report = prop_report_warning; |
|||
else if (strcmp (optarg + 15, "error") == 0) |
|||
params.lam_u48_report = prop_report_error; |
|||
else |
|||
einfo (_("%F%P: invalid option for -z lam-u48-report=: %s\n"), |
|||
optarg + 15); |
|||
} |
|||
else if (strcmp (optarg, "lam-u57") == 0) |
|||
params.lam_u57 = TRUE; |
|||
else if (strncmp (optarg, "lam-u57-report=", 15) == 0) |
|||
{ |
|||
if (strcmp (optarg + 15, "none") == 0) |
|||
params.lam_u57_report = prop_report_none; |
|||
else if (strcmp (optarg + 15, "warning") == 0) |
|||
params.lam_u57_report = prop_report_warning; |
|||
else if (strcmp (optarg + 15, "error") == 0) |
|||
params.lam_u57_report = prop_report_error; |
|||
else |
|||
einfo (_("%F%P: invalid option for -z lam-u57-report=: %s\n"), |
|||
optarg + 15); |
|||
} |
|||
else if (strncmp (optarg, "lam-report=", 11) == 0) |
|||
{ |
|||
if (strcmp (optarg + 11, "none") == 0) |
|||
{ |
|||
params.lam_u48_report = prop_report_none; |
|||
params.lam_u57_report = prop_report_none; |
|||
} |
|||
else if (strcmp (optarg + 11, "warning") == 0) |
|||
{ |
|||
params.lam_u48_report = prop_report_warning; |
|||
params.lam_u57_report = prop_report_warning; |
|||
} |
|||
else if (strcmp (optarg + 11, "error") == 0) |
|||
{ |
|||
params.lam_u48_report = prop_report_error; |
|||
params.lam_u57_report = prop_report_error; |
|||
} |
|||
else |
|||
einfo (_("%F%P: invalid option for -z lam-report=: %s\n"), |
|||
optarg + 11); |
|||
} |
|||
' |
|||
|
|||
PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_LAM" |
|||
PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_LAM" |
|||
@ -0,0 +1,11 @@ |
|||
#source: property-x86-empty.s |
|||
#source: property-x86-lam-u48.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 feature used: x86 |
|||
x86 ISA used: |
|||
@ -0,0 +1,11 @@ |
|||
#source: property-x86-lam-u48.s |
|||
#source: property-x86-empty.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 feature used: x86 |
|||
x86 ISA used: |
|||
@ -0,0 +1,11 @@ |
|||
#source: property-x86-lam-u48.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 feature: LAM_U48 |
|||
x86 feature used: x86 |
|||
x86 ISA used: |
|||
@ -0,0 +1,12 @@ |
|||
#source: property-x86-3.s |
|||
#source: property-x86-lam-u48.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 ISA needed: x86-64-baseline, x86-64-v2, <unknown: 10>, <unknown: 20> |
|||
x86 feature used: x86 |
|||
x86 ISA used: x86-64-v2, x86-64-v4, <unknown: 20>, <unknown: 80> |
|||
@ -0,0 +1,12 @@ |
|||
#source: property-x86-lam-u48.s |
|||
#source: property-x86-3.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 ISA needed: x86-64-baseline, x86-64-v2, <unknown: 10>, <unknown: 20> |
|||
x86 feature used: x86 |
|||
x86 ISA used: x86-64-v2, x86-64-v4, <unknown: 20>, <unknown: 80> |
|||
@ -0,0 +1,11 @@ |
|||
#source: property-x86-empty.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 -z lam-u48 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 feature: LAM_U48 |
|||
x86 feature used: x86 |
|||
x86 ISA used: |
|||
@ -0,0 +1,11 @@ |
|||
#source: start.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 -z lam-u48 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 feature: LAM_U48 |
|||
x86 feature used: x86 |
|||
x86 ISA used: |
|||
@ -0,0 +1,27 @@ |
|||
.section ".note.gnu.property", "a" |
|||
.ifdef __64_bit__ |
|||
.p2align 3 |
|||
.else |
|||
.p2align 2 |
|||
.endif |
|||
.long 1f - 0f /* name length */ |
|||
.long 5f - 2f /* data length */ |
|||
.long 5 /* note type */ |
|||
0: .asciz "GNU" /* vendor name */ |
|||
1: |
|||
.ifdef __64_bit__ |
|||
.p2align 3 |
|||
.else |
|||
.p2align 2 |
|||
.endif |
|||
2: .long 0xc0000002 /* pr_type. */ |
|||
.long 4f - 3f /* pr_datasz. */ |
|||
3: |
|||
.long 0x4 |
|||
4: |
|||
.ifdef __64_bit__ |
|||
.p2align 3 |
|||
.else |
|||
.p2align 2 |
|||
.endif |
|||
5: |
|||
@ -0,0 +1,11 @@ |
|||
#source: property-x86-empty.s |
|||
#source: property-x86-lam-u57.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 feature used: x86 |
|||
x86 ISA used: |
|||
@ -0,0 +1,11 @@ |
|||
#source: property-x86-lam-u57.s |
|||
#source: property-x86-empty.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 feature used: x86 |
|||
x86 ISA used: |
|||
@ -0,0 +1,11 @@ |
|||
#source: property-x86-lam-u57.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 feature: LAM_U57 |
|||
x86 feature used: x86 |
|||
x86 ISA used: |
|||
@ -0,0 +1,12 @@ |
|||
#source: property-x86-3.s |
|||
#source: property-x86-lam-u57.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 ISA needed: x86-64-baseline, x86-64-v2, <unknown: 10>, <unknown: 20> |
|||
x86 feature used: x86 |
|||
x86 ISA used: x86-64-v2, x86-64-v4, <unknown: 20>, <unknown: 80> |
|||
@ -0,0 +1,12 @@ |
|||
#source: property-x86-lam-u57.s |
|||
#source: property-x86-3.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 ISA needed: x86-64-baseline, x86-64-v2, <unknown: 10>, <unknown: 20> |
|||
x86 feature used: x86 |
|||
x86 ISA used: x86-64-v2, x86-64-v4, <unknown: 20>, <unknown: 80> |
|||
@ -0,0 +1,11 @@ |
|||
#source: property-x86-empty.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 -z lam-u57 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 feature: LAM_U57 |
|||
x86 feature used: x86 |
|||
x86 ISA used: |
|||
@ -0,0 +1,11 @@ |
|||
#source: start.s |
|||
#as: --64 -defsym __64_bit__=1 -mx86-used-note=yes |
|||
#ld: -r -melf_x86_64 -z lam-u57 |
|||
#readelf: -n |
|||
|
|||
Displaying notes found in: .note.gnu.property |
|||
[ ]+Owner[ ]+Data size[ ]+Description |
|||
GNU 0x00000030 NT_GNU_PROPERTY_TYPE_0 |
|||
Properties: x86 feature: LAM_U57 |
|||
x86 feature used: x86 |
|||
x86 ISA used: |
|||
@ -0,0 +1,27 @@ |
|||
.section ".note.gnu.property", "a" |
|||
.ifdef __64_bit__ |
|||
.p2align 3 |
|||
.else |
|||
.p2align 2 |
|||
.endif |
|||
.long 1f - 0f /* name length */ |
|||
.long 5f - 2f /* data length */ |
|||
.long 5 /* note type */ |
|||
0: .asciz "GNU" /* vendor name */ |
|||
1: |
|||
.ifdef __64_bit__ |
|||
.p2align 3 |
|||
.else |
|||
.p2align 2 |
|||
.endif |
|||
2: .long 0xc0000002 /* pr_type. */ |
|||
.long 4f - 3f /* pr_datasz. */ |
|||
3: |
|||
.long 0x8 |
|||
4: |
|||
.ifdef __64_bit__ |
|||
.p2align 3 |
|||
.else |
|||
.p2align 2 |
|||
.endif |
|||
5: |
|||
Loading…
Reference in new issue