[llvm] r333424 - [llvm-readobj] Support GNU_PROPERTY_X86_FEATURE_1_AND notes in .note.gnu.property
Galina Kistanova via llvm-commits
llvm-commits at lists.llvm.org
Wed May 30 10:34:33 PDT 2018
Hello Alexander,
This commit broke tests for couple of our builders yesterday:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/17420
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win
. . .
Failing Tests (1):
LLVM :: tools/llvm-readobj/note-gnu-property.s
Please have a look ASAP?
Thanks
Galina
On Tue, May 29, 2018 at 7:49 AM, Alexander Ivchenko via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: aivchenk
> Date: Tue May 29 07:49:51 2018
> New Revision: 333424
>
> URL: http://llvm.org/viewvc/llvm-project?rev=333424&view=rev
> Log:
> [llvm-readobj] Support GNU_PROPERTY_X86_FEATURE_1_AND notes in
> .note.gnu.property
>
> This patch allows parsing GNU_PROPERTY_X86_FEATURE_1_AND
> notes in .note.gnu.property sections. These notes
> indicate that the object file is built to support Intel CET.
>
> patch by mike.dvoretsky
>
> Differential Revision: https://reviews.llvm.org/D47473
>
>
> Modified:
> llvm/trunk/include/llvm/BinaryFormat/ELF.h
> llvm/trunk/test/tools/llvm-readobj/note-gnu-property.s
> llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
>
> Modified: llvm/trunk/include/llvm/BinaryFormat/ELF.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/
> llvm/BinaryFormat/ELF.h?rev=333424&r1=333423&r2=333424&view=diff
> ============================================================
> ==================
> --- llvm/trunk/include/llvm/BinaryFormat/ELF.h (original)
> +++ llvm/trunk/include/llvm/BinaryFormat/ELF.h Tue May 29 07:49:51 2018
> @@ -1308,6 +1308,13 @@ enum {
> enum {
> GNU_PROPERTY_STACK_SIZE = 1,
> GNU_PROPERTY_NO_COPY_ON_PROTECTED = 2,
> + GNU_PROPERTY_X86_FEATURE_1_AND = 0xc0000002
> +};
> +
> +// CET properties
> +enum {
> + GNU_PROPERTY_X86_FEATURE_1_IBT = 1 << 0,
> + GNU_PROPERTY_X86_FEATURE_1_SHSTK = 1 << 1
> };
>
> // AMDGPU specific notes.
>
> Modified: llvm/trunk/test/tools/llvm-readobj/note-gnu-property.s
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/
> llvm-readobj/note-gnu-property.s?rev=333424&r1=333423&r2=333424&view=diff
> ============================================================
> ==================
> --- llvm/trunk/test/tools/llvm-readobj/note-gnu-property.s (original)
> +++ llvm/trunk/test/tools/llvm-readobj/note-gnu-property.s Tue May 29
> 07:49:51 2018
> @@ -2,16 +2,21 @@
> // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t
> // RUN: llvm-readobj -elf-output-style GNU --notes %t | FileCheck %s
>
> -// CHECK: Displaying notes found at file offset 0x00000040 with
> length 0x00000070:
> +// CHECK: Displaying notes found at file offset 0x00000040 with
> length 0x000000b8:
> // CHECK-NEXT: Owner Data size Description
> -// CHECK-NEXT: GNU 0x00000060
> NT_GNU_PROPERTY_TYPE_0 (property note)
> +// CHECK-NEXT: GNU 0x000000a8
> NT_GNU_PROPERTY_TYPE_0 (property note)
> // CHECK-NEXT: Properties: stack size: 0x100
> // CHECK-NEXT: stack size: 0x100
> // CHECK-NEXT: no copy on protected
> +// CHECK-NEXT: X86 features: SHSTK
> +// CHECK-NEXT: X86 features: IBT, SHSTK
> +// CHECK-NEXT: X86 features: none
> // CHECK-NEXT: <application-specific type 0xfefefefe>
> // CHECK-NEXT: stack size: <corrupt length: 0x0>
> // CHECK-NEXT: stack size: <corrupt length: 0x4>
> // CHECK-NEXT: no copy on protected <corrupt length: 0x1>
> +// CHECK-NEXT: X86 features: <corrupt length: 0x0>
> +// CHECK-NEXT: X86 features: IBT, <unknown flags: 0xf000f000f000f000>
> // CHECK-NEXT: <corrupt type (0x2) datasz: 0x1>
>
> .section ".note.gnu.property", "a"
> @@ -26,7 +31,7 @@ begin:
> .long 8 /* Data size */
> .quad 0x100 /* Data (stack size) */
> .p2align 3 /* Align to 8 byte for 64 bit */
> -
> +
> /* Test we handle alignment properly */
> .long 1 /* Type: GNU_PROPERTY_STACK_SIZE */
> .long 8 /* Data size */
> @@ -36,6 +41,23 @@ begin:
> .long 2 /* Type: GNU_PROPERTY_NO_COPY_ON_PROTECTED */
> .long 0 /* Data size */
> .p2align 3 /* Align to 8 byte for 64 bit */
> +
> + /* CET property note */
> + .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */
> + .long 8 /* Data size */
> + .quad 2 /* GNU_PROPERTY_X86_FEATURE_1_SHSTK */
> + .p2align 3 /* Align to 8 byte for 64 bit */
> +
> + /* CET property note with padding */
> + .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */
> + .long 4 /* Data size */
> + .long 3 /* Full CET support */
> + .p2align 3 /* Align to 8 byte for 64 bit */
> +
> + .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */
> + .long 8 /* Data size */
> + .quad 0 /* Empty flags, not an error */
> + .p2align 3 /* Align to 8 byte for 64 bit */
>
> /* All notes below are broken. Test we are able to report them. */
>
> @@ -60,6 +82,17 @@ begin:
> .long 1 /* Data size (corrupted) */
> .byte 1 /* Data */
> .p2align 3 /* Align to 8 byte for 64 bit */
> +
> + /* CET note with size zero */
> + .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */
> + .long 0 /* Data size */
> + .p2align 3 /* Align to 8 byte for 64 bit */
> +
> + /* CET note with bad flags */
> + .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */
> + .long 8 /* Data size */
> + .quad 0xf000f000f000f001 /* GNU_PROPERTY_X86_FEATURE_1_IBT and bad bits
> */
> + .p2align 3 /* Align to 8 byte for 64 bit */
>
> /* GNU_PROPERTY_NO_COPY_ON_PROTECTED with pr_datasz and without data */
> .long 2 /* Type: GNU_PROPERTY_NO_COPY_ON_PROTECTED */
>
> Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-
> readobj/ELFDumper.cpp?rev=333424&r1=333423&r2=333424&view=diff
> ============================================================
> ==================
> --- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
> +++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Tue May 29 07:49:51 2018
> @@ -3457,7 +3457,7 @@ static void printGNUProperty(raw_ostream
> case GNU_PROPERTY_STACK_SIZE: {
> OS << " stack size: ";
> if (DataSize == sizeof(typename ELFT::uint))
> - OS << format("0x%x\n",
> + OS << format("0x%lx\n",
> (uint64_t)(*(const typename ELFT::Addr *)Data.data()));
> else
> OS << format("<corrupt length: 0x%x>\n", DataSize);
> @@ -3469,6 +3469,36 @@ static void printGNUProperty(raw_ostream
> OS << format(" <corrupt length: 0x%x>", DataSize);
> OS << "\n";
> break;
> + case GNU_PROPERTY_X86_FEATURE_1_AND:
> + OS << " X86 features: ";
> + if (DataSize != 4 && DataSize != 8) {
> + OS << format("<corrupt length: 0x%x>\n", DataSize);
> + break;
> + }
> + uint64_t CFProtection =
> + (DataSize == 4)
> + ? support::endian::read32<ELFT::
> TargetEndianness>(Data.data())
> + : support::endian::read64<ELFT::
> TargetEndianness>(Data.data());
> + if (CFProtection == 0) {
> + OS << "none\n";
> + break;
> + }
> + if (CFProtection & GNU_PROPERTY_X86_FEATURE_1_IBT) {
> + OS << "IBT";
> + CFProtection &= ~GNU_PROPERTY_X86_FEATURE_1_IBT;
> + if (CFProtection)
> + OS << ", ";
> + }
> + if (CFProtection & GNU_PROPERTY_X86_FEATURE_1_SHSTK) {
> + OS << "SHSTK";
> + CFProtection &= ~GNU_PROPERTY_X86_FEATURE_1_SHSTK;
> + if (CFProtection)
> + OS << ", ";
> + }
> + if (CFProtection)
> + OS << format("<unknown flags: 0x%lx>", CFProtection);
> + OS << "\n";
> + break;
> }
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180530/be097412/attachment.html>
More information about the llvm-commits
mailing list