[ARM/FDPIC v2 20/21] [ARM][testsuite] FDPIC: Adjust pr43698.c to avoid clash with uclibc.

2018-07-13 Thread christophe.lyon
From: Christophe Lyon uclibc defines bswap_32, so use a different name in this test. 2018-XX-XX Christophe Lyon gcc/testsuite/ * gcc.target/arm/pr43698.c (bswap_32): Rename as my_bswap_32. Change-Id: I2591bd911030814331cabf97ee5cf6cf8124b4f3 diff --git

[ARM/FDPIC v2 21/21] [ARM][testsuite] FDPIC: Skip tests using architecture older than v7

2018-07-13 Thread christophe.lyon
From: Christophe Lyon Since FDPIC requires an architecture >=7, these tests fail because they enforce and older version. They would pass if the compiler didn't bail out though. 2018-07-13 Christophe Lyon * gcc.target/arm/armv6-unaligned-load-ice.c: Add arm_arch

[ARM/FDPIC v2 19/21] [ARM][testsuite] FDPIC: Enable tests on pie_enabled targets

2018-07-13 Thread christophe.lyon
From: Christophe Lyon Some tests have the "nonpic" guard, but pass on arm*-*-uclinuxfdpiceabi because it is in PIE mode by default. Rather than adding this target to all these tests, add the "pie_enabled" effective target. 2018-XX-XX Christophe Lyon gcc/testsuite/ *

[ARM/FDPIC v2 18/21] [ARM][testsuite] FDPIC: Handle *-*-uclinux*

2018-07-13 Thread christophe.lyon
From: Christophe Lyon Add *-*-uclinux* to tests that work on this target. 2018-XX-XX Christophe Lyon gcc/testsuite/ * g++.dg/abi/forced.C: Add *-*-uclinux*. * g++.dg/abi/guard2.C: Likewise. * g++.dg/ext/cleanup-10.C: Likewise. *

[ARM/FDPIC v2 17/21] [ARM][testsuite] FDPIC: Skip tests that don't work in PIC mode

2018-07-13 Thread christophe.lyon
From: Christophe Lyon Some tests fail on arm*-*-uclinuxfdpiceabi because it generates PIC code and they don't support it: skip them. They also fail on arm*-linux* when forcing -fPIC. 2018-XX-XX Christophe Lyon gcc/testsuite/ * gcc.target/arm/eliminate.c: Accept only nonpic

[ARM/FDPIC v2 16/21] [ARM][testsuite] FDPIC: Skip v8-m and v6-m tests that currently produce an ICE

2018-07-13 Thread christophe.lyon
From: Christophe Lyon v6-M and v8-M are not supported currently in FDPIC mode, it's better to skip the tests. 2018-XX-XX Christophe Lyon Mickaël Guêné gcc/testsuite/ * gcc.target/arm/atomic-comp-swap-release-acquire-3.c: Skip on arm*-*-uclinuxfdpiceabi.

[ARM/FDPIC v2 15/21] [ARM][testsuite] FDPIC: Adjust scan-assembler patterns.

2018-07-13 Thread christophe.lyon
From: Christophe Lyon In FDPIC mode, r9 is saved in addition to other registers, so update the expected patterns accordingly. 2018-XX-XX Christophe Lyon Mickaël Guêné * gcc/testsuite/ * gcc.target/arm/interrupt-1.c: Add scan-assembler pattern for

[ARM/FDPIC v2 13/21] [ARM] FDPIC: Force LSB bit for PC in Cortex-M architecture

2018-07-13 Thread christophe.lyon
From: Christophe Lyon Without this, when we are unwinding across a signal frame we can jump to an even address which leads to an exception. This is needed in __gnu_persnality_sigframe_fdpic() when restoring the PC from the signal frame since the PC saved by the kernel has the LSB bit set to

[ARM/FDPIC v2 14/21] [ARM][testsuite] FDPIC: Skip unsupported tests

2018-07-13 Thread christophe.lyon
From: Christophe Lyon Several tests cannot work on ARM-FDPIC for various reasons: skip them, or skip some directives. gcc.dg/20020312-2.c: Skip since it forces -fno-pic. gcc.target/arm/: * Skip since r9 is clobbered by assembly code: 20051215-1.c mmx-1.c pr61948.c pr77933-1.c

[ARM/FDPIC v2 12/21] [ARM] FDPIC: Restore r9 after we call __aeabi_read_tp

2018-07-13 Thread christophe.lyon
From: Christophe Lyon We call __aeabi_read_tp() to get the thread pointer. Since this is a function call, we have to restore the FDPIC register afterwards. 2018-XX-XX Christophe Lyon Mickaël Guêné gcc/ * config/arm/arm.c (arm_load_tp): Add FDPIC support. *

[ARM/FDPIC v2 11/21] [ARM] FDPIC: Add support to unwind FDPIC signal frame

2018-07-13 Thread christophe.lyon
From: Christophe Lyon 2018-XX-XX Christophe Lyon Mickaël Guêné libgcc/ * unwind-arm-common.inc (ARM_SET_R7_RT_SIGRETURN) (THUMB2_SET_R7_RT_SIGRETURN, FDPIC_LDR_R12_WITH_FUNCDESC) (FDPIC_LDR_R9_WITH_GOT, FDPIC_LDR_PC_WITH_RESTORER)

[ARM/FDPIC v2 10/21] [ARM] FDPIC: Implement TLS support.

2018-07-13 Thread christophe.lyon
From: Christophe Lyon Support additional relocations: TLS_GD32_FDPIC, TLS_LDM32_FDPIC, and TLS_IE32_FDPIC. We do not support the GNU2 TLS dialect. 2018-XX-XX Christophe Lyon Mickaël Guêné gcc/ * config/arm/arm.c (tls_reloc): Add TLS_GD32_FDPIC,

[ARM/FDPIC v2 09/21] [ARM] FDPIC: Add support for taking address of nested function

2018-07-13 Thread christophe.lyon
From: Christophe Lyon In FDPIC mode, the trampoline generated to support pointers to nested functions looks like: .wordtrampoline address .wordtrampoline GOT address ldr r12, [pc, #8] ldr r9, [pc, #8] ldr

[ARM/FDPIC v2 08/21] [ARM] FDPIC: Ensure local/global binding for function descriptors

2018-07-13 Thread christophe.lyon
From: Christophe Lyon Use local binding rules to decide whether we can use GOTOFFFUNCDESC to compute the function address. 2018-XX-XX Christophe Lyon Mickaël Guêné gcc/ * config/arm/arm.c (arm_local_funcdesc_p): New function. (legitimize_pic_address): Ensure

[ARM/FDPIC v2 07/21] [ARM] FDPIC: Avoid saving/restoring r9 on stack since it is RO

2018-07-13 Thread christophe.lyon
From: Christophe Lyon 2018-XX-XX Christophe Lyon Mickaël Guêné gcc/ * config/arm/arm.c (arm_compute_save_reg0_reg12_mask): Handle FDPIC. (thumb1_compute_save_core_reg_mask): Likewise. Change-Id: Ib534cf91704cdc740867b46a8fe45fda27894562 diff --git

[ARM/FDPIC v2 06/21] [ARM] FDPIC: Add support for c++ exceptions

2018-07-13 Thread christophe.lyon
From: Christophe Lyon The main difference with existing support is that function addresses are function descriptor addresses instead. This means that all code dealing with function pointers now has to cope with function descriptors instead. For the same reason, Linux kernel helpers can no

[ARM/FDPIC v2 05/21] [ARM] FDPIC: Fix __do_global_dtors_aux and frame_dummy generation

2018-07-13 Thread christophe.lyon
From: Christophe Lyon In FDPIC, we need to make sure __do_global_dtors_aux and frame_dummy are referenced by their address, not by pointers to the function descriptors. 2018-XX-XX Christophe Lyon Mickaël Guêné * libgcc/crtstuff.c: Add support for FDPIC. Change-Id:

[ARM/FDPIC v2 04/21] [ARM] FDPIC: Add support for FDPIC for arm architecture

2018-07-13 Thread christophe.lyon
From: Christophe Lyon The FDPIC register is hard-coded to r9, as defined in the ABI. We have to disable tailcall optimizations if we don't know if the target function is in the same module. If not, we have to set r9 to the value associated with the target module. When generating a symbol

[ARM/FDPIC v2 03/21] [ARM] FDPIC: Force FDPIC related options unless -mno-fdpic is provided

2018-07-13 Thread christophe.lyon
From: Christophe Lyon In FDPIC mode, we set -fPIE unless the user provides -fno-PIE, -fpie, -fPIC or -fpic: indeed FDPIC code is PIC, but we want to generate code for executables rather than shared libraries by default. We also make sure to use the --fdpic assembler option, and select the

[ARM/FDPIC v2 02/21] [ARM] FDPIC: Handle arm*-*-uclinuxfdpiceabi in configure scripts

2018-07-13 Thread christophe.lyon
From: Christophe Lyon The new arm-uclinuxfdpiceabi target behaves pretty much like arm-linux-gnueabi. In order the enable the same set of features, we have to update several configure scripts that generally match targets like *-*-linux*: in most places, we add *-uclinux* where there is already

[ARM/FDPIC v2 00/21] FDPIC ABI for ARM

2018-07-13 Thread christophe.lyon
tps://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=f1ac0afe481e83c9a33f247b81fa7de789edc4d9 [5] https://git.qemu.org/?p=qemu.git;a=commit;h=e8fa72957419c11984608062c7dcb204a6003a06 [6] https://git.linaro.org/people/christophe.lyon/uclibc.git/log/?h=uClibc-0.9.33.2-fdpi

[ARM/FDPIC v2 01/21] [ARM] FDPIC: Add -mfdpic option support

2018-07-13 Thread christophe.lyon
From: Christophe Lyon 2018-XX-XX Christophe Lyon Mickaël Guêné gcc/ * config/arm/arm.opt: Add -mfdpic option. Change-Id: Ie5c4ed7434488933de6133186da09cd3ea1291a7 diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt index a1286a4..231c1cb 100644 ---