From: Wilco Dijkstra Date: Mon, 24 Jul 2017 18:06:37 +0000 (+0000) Subject: re PR target/79041 (aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despi... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d47d34bb22f756731475ea700d165f4d855d712f;p=gcc.git re PR target/79041 (aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used) Fix PR79041 As described in PR79041, -mcmodel=large -mpc-relative-literal-loads may be used to avoid generating ADRP/ADD or ADRP/LDR. However both trunk and GCC7 may still emit ADRP for some constant pool literals. Fix this by adding a aarch64_pcrelative_literal_loads check. gcc/ PR target/79041 * config/aarch64/aarch64.c (aarch64_classify_symbol): Avoid SYMBOL_SMALL_ABSOLUTE for literals with pc-relative literals gcc/testsuite/ * gcc.target/aarch64/pr79041-2.c: New test. From-SVN: r250478 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c77ba24254c..e929c4d50d9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-07-24 Wilco Dijkstra + + PR target/79041 + * config/aarch64/aarch64.c (aarch64_classify_symbol): + Avoid SYMBOL_SMALL_ABSOLUTE for literals with pc-relative literals. + 2017-07-24 Carl Love * config/rs6000/rs6000-c.c: Add support for built-in functions diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index b8a4160d9de..d753666ef67 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -10193,7 +10193,7 @@ aarch64_classify_symbol (rtx x, rtx offset) /* This is alright even in PIC code as the constant pool reference is always PC relative and within the same translation unit. */ - if (CONSTANT_POOL_ADDRESS_P (x)) + if (!aarch64_pcrelative_literal_loads && CONSTANT_POOL_ADDRESS_P (x)) return SYMBOL_SMALL_ABSOLUTE; else return SYMBOL_FORCE_TO_MEM; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bb4302f0541..de46deffdcf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-07-24 Wilco Dijkstra + + PR target/79041 + * gcc.target/aarch64/pr79041-2.c: New test. + 2017-07-24 Carl Love * gcc.target/powerpc/builtins-3-p9-runnable.c: Add new test file for diff --git a/gcc/testsuite/gcc.target/aarch64/pr79041-2.c b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c new file mode 100644 index 00000000000..e7899725bad --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcmodel=large -mpc-relative-literal-loads" } */ + +__int128 +t (void) +{ + return (__int128)1 << 80; +} + +/* { dg-final { scan-assembler "adr" } } */