From b76415508692fc0bc85515a8215b874c7e215431 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Sun, 24 May 2020 19:41:13 -0700 Subject: [PATCH] gcc: xtensa: delegitimize UNSPEC_PLT This fixes 'non-delegitimized UNSPEC 3 found in variable location' notes issued when building libraries which interferes with running tests. 2020-05-27 Max Filippov gcc/ * config/xtensa/xtensa.c (xtensa_delegitimize_address): New function. (TARGET_DELEGITIMIZE_ADDRESS): New macro. --- gcc/config/xtensa/xtensa.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 0a5ecd23352..550c9cdfd89 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -186,6 +186,8 @@ static HOST_WIDE_INT xtensa_constant_alignment (const_tree, HOST_WIDE_INT); static HOST_WIDE_INT xtensa_starting_frame_offset (void); static unsigned HOST_WIDE_INT xtensa_asan_shadow_offset (void); +static rtx xtensa_delegitimize_address (rtx); + /* These hooks specify assembly directives for creating certain kinds @@ -333,6 +335,9 @@ static unsigned HOST_WIDE_INT xtensa_asan_shadow_offset (void); #undef TARGET_HAVE_SPECULATION_SAFE_VALUE #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed +#undef TARGET_DELEGITIMIZE_ADDRESS +#define TARGET_DELEGITIMIZE_ADDRESS xtensa_delegitimize_address + struct gcc_target targetm = TARGET_INITIALIZER; @@ -4424,4 +4429,23 @@ xtensa_asan_shadow_offset (void) return HOST_WIDE_INT_UC (0x10000000); } +static rtx +xtensa_delegitimize_address (rtx op) +{ + switch (GET_CODE (op)) + { + case CONST: + return xtensa_delegitimize_address (XEXP (op, 0)); + + case UNSPEC: + if (XINT (op, 1) == UNSPEC_PLT) + return XVECEXP(op, 0, 0); + break; + + default: + break; + } + return op; +} + #include "gt-xtensa.h" -- 2.30.2