|
Packit |
6c4009 |
/* Test CET property note parser.
|
|
Packit |
6c4009 |
Copyright (C) 2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <cet.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.text
|
|
Packit |
6c4009 |
.p2align 4,,15
|
|
Packit |
6c4009 |
.globl bar
|
|
Packit |
6c4009 |
.type bar, @function
|
|
Packit |
6c4009 |
/* Since this function doesn't start with ENDBR, it should lead to the
|
|
Packit |
6c4009 |
IBT violation when called indirectly. */
|
|
Packit |
6c4009 |
bar:
|
|
Packit |
6c4009 |
.cfi_startproc
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
.cfi_endproc
|
|
Packit |
6c4009 |
.size bar, .-bar
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if __SIZEOF_PTRDIFF_T__ == 8
|
|
Packit |
6c4009 |
# define ALIGN 3
|
|
Packit |
6c4009 |
#elif __SIZEOF_PTRDIFF_T__ == 4
|
|
Packit |
6c4009 |
# define ALIGN 2
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* In NT_GNU_PROPERTY_TYPE_0 note, add a GNU_PROPERTY_STACK_SIZE property
|
|
Packit |
6c4009 |
before the GNU_PROPERTY_X86_FEATURE_1_AND property. */
|
|
Packit |
6c4009 |
.section ".note.gnu.property", "a"
|
|
Packit |
6c4009 |
.p2align ALIGN
|
|
Packit |
6c4009 |
.long 1f - 0f /* name length */
|
|
Packit |
6c4009 |
.long 5f - 2f /* data length */
|
|
Packit |
6c4009 |
.long 5 /* note type */
|
|
Packit |
6c4009 |
0: .asciz "GNU" /* vendor name */
|
|
Packit |
6c4009 |
1:
|
|
Packit |
6c4009 |
.p2align ALIGN
|
|
Packit |
6c4009 |
2:
|
|
Packit |
6c4009 |
.long 1 /* pr_type. */
|
|
Packit |
6c4009 |
.long 4f - 3f /* pr_datasz. */
|
|
Packit |
6c4009 |
3:
|
|
Packit |
6c4009 |
#if __SIZEOF_PTRDIFF_T__ == 8
|
|
Packit |
6c4009 |
.long 0x800
|
|
Packit |
6c4009 |
.long 0x800
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
.long 0x08000800
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
4:
|
|
Packit |
6c4009 |
.p2align ALIGN
|
|
Packit |
6c4009 |
5:
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.section .note.GNU-stack,"",@progbits
|