https://gcc.gnu.org/g:e267069621eeb5b88177bb60e0da1f21967820e0

commit r17-6127-ge267069621eeb5b88177bb60e0da1f21967820e0
Author: John David Anglin <[email protected]>
Date:   Tue Nov 10 13:08:18 2026 -0500

    hopa: Fix read_only_operand handling for non-HP-UX targets
    
    The read_only_operand predicate currently assumes that the constant pool
    is placed in the TEXT section when flag_pic is false, which is specific
    to 32-bit HP-UX. Non-HP-UX targets (such as pa-linux) do not share
    this property.
    
    This patch updates the predicate to check for !TARGET_HPUX, ensuring
    that the correct constant pool logic applies across both HP-UX and
    non-HP-UX PA-RISC targets.
    
    2026-11-10  John David Anglin  <[email protected]>
    
    gcc/ChangeLog:
    
            * config/pa/predicates.md (read_only_operand): Check !TARGET_HPUX
            when considering CONSTANT_POOL_ADDRESS_P for SYMBOL_REF.

Diff:
---
 gcc/config/pa/predicates.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/pa/predicates.md b/gcc/config/pa/predicates.md
index 9ff450daa763..70ac7f55701b 100644
--- a/gcc/config/pa/predicates.md
+++ b/gcc/config/pa/predicates.md
@@ -527,7 +527,8 @@
     op = XEXP (XEXP (op, 0), 0);
   if (GET_CODE (op) == SYMBOL_REF)
     {
-      if (flag_pic)
+      /* 32-bit HP-UX has constant pool in TEXT section.  */
+      if (flag_pic || !TARGET_HPUX)
         return SYMBOL_REF_FLAG (op) && !CONSTANT_POOL_ADDRESS_P (op);
       else
         return SYMBOL_REF_FLAG (op) || CONSTANT_POOL_ADDRESS_P (op);

Reply via email to