Skip to content

Commit

Permalink
[AArch64] Only build & test pauth code for LP64
Browse files Browse the repository at this point in the history
gcc/
	* config/aarch64/aarch64-builtins.c (aarch64_init_builtins): Register
	register pauth builtins for LP64 only.

libgcc/
	* config/aarch64/aarch64-unwind.h: Empty this file on ILP32.
	* unwind-dw2.c (execute_cfa_program):  Only multiplexing
	DW_CFA_GNU_window_save for AArch64 and LP64.

gcc/testsuite/
	* testsuite/gcc.target/aarch64/return_address_sign_1.c: Enable on LP64
	only.
	* testsuite/gcc.target/aarch64/return_address_sign_2.c: Likewise.
	* testsuite/gcc.target/aarch64/return_address_sign_3.c: Likewise.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244732 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
jiwang committed Jan 20, 2017
1 parent 864029a commit 58c979e
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 6 deletions.
5 changes: 5 additions & 0 deletions gcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2017-01-20 Jiong Wang <[email protected]>

* config/aarch64/aarch64-builtins.c (aarch64_init_builtins): Register
register pauth builtins for LP64 only.

2017-01-20 Marek Polacek <[email protected]>

PR c/79152
Expand Down
11 changes: 8 additions & 3 deletions gcc/config/aarch64/aarch64-builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -983,9 +983,14 @@ aarch64_init_builtins (void)
aarch64_init_crc32_builtins ();
aarch64_init_builtin_rsqrt ();

/* Initialize pointer authentication builtins which are backed by instructions
in NOP encoding space. */
aarch64_init_pauth_hint_builtins ();
/* Initialize pointer authentication builtins which are backed by instructions
in NOP encoding space.
NOTE: these builtins are supposed to be used by libgcc unwinder only, as
there is no support on return address signing under ILP32, we don't
register them. */
if (!TARGET_ILP32)
aarch64_init_pauth_hint_builtins ();
}

tree
Expand Down
7 changes: 7 additions & 0 deletions gcc/testsuite/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2017-01-20 Jiong Wang <[email protected]>

* testsuite/gcc.target/aarch64/return_address_sign_1.c: Enable on LP64
only.
* testsuite/gcc.target/aarch64/return_address_sign_2.c: Likewise.
* testsuite/gcc.target/aarch64/return_address_sign_3.c: Likewise.

2017-01-20 Nathan Sidwell <[email protected]>

PR c++/79495
Expand Down
1 change: 1 addition & 0 deletions gcc/testsuite/gcc.target/aarch64/return_address_sign_1.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* Testing return address signing where no combined instructions used. */
/* { dg-do compile } */
/* { dg-options "-O2 -msign-return-address=all" } */
/* { dg-require-effective-target lp64 } */

int foo (int);

Expand Down
1 change: 1 addition & 0 deletions gcc/testsuite/gcc.target/aarch64/return_address_sign_2.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* Testing return address signing where combined instructions used. */
/* { dg-do compile } */
/* { dg-options "-O2 -msign-return-address=all" } */
/* { dg-require-effective-target lp64 } */

int foo (int);
int bar (int, int);
Expand Down
1 change: 1 addition & 0 deletions gcc/testsuite/gcc.target/aarch64/return_address_sign_3.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* Testing the disable of return address signing. */
/* { dg-do compile } */
/* { dg-options "-O2 -msign-return-address=all" } */
/* { dg-require-effective-target lp64 } */

int bar (int, int);

Expand Down
6 changes: 6 additions & 0 deletions libgcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2017-01-20 Jiong Wang <[email protected]>

* config/aarch64/aarch64-unwind.h: Empty this file on ILP32.
* unwind-dw2.c (execute_cfa_program): Only multiplexing
DW_CFA_GNU_window_save for AArch64 and LP64.

2017-01-20 Jiong Wang <[email protected]>

* config/aarch64/linux-unwind.h: Always include aarch64-unwind.h.
Expand Down
4 changes: 2 additions & 2 deletions libgcc/config/aarch64/aarch64-unwind.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */

#ifndef AARCH64_UNWIND_H
#if !defined (AARCH64_UNWIND_H) && !defined (__ILP32__)
#define AARCH64_UNWIND_H

#define DWARF_REGNUM_AARCH64_RA_STATE 34
Expand Down Expand Up @@ -84,4 +84,4 @@ aarch64_frob_update_context (struct _Unwind_Context *context,
return;
}

#endif /* defined AARCH64_UNWIND_H */
#endif /* defined AARCH64_UNWIND_H && defined __ILP32__ */
2 changes: 1 addition & 1 deletion libgcc/unwind-dw2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ execute_cfa_program (const unsigned char *insn_ptr,
break;

case DW_CFA_GNU_window_save:
#ifdef __aarch64__
#if defined (__aarch64__) && !defined (__ILP32__)
/* This CFA is multiplexed with Sparc. On AArch64 it's used to toggle
return address signing status. */
fs->regs.reg[DWARF_REGNUM_AARCH64_RA_STATE].loc.offset ^= 1;
Expand Down

0 comments on commit 58c979e

Please sign in to comment.