if (code != VAR_DECL && code != FUNCTION_DECL)
return;
- /* If this is not an external reference, it can't be half-pic. */
- if (!TREE_EXTERNAL (decl))
- return;
-
asm_name = DECL_ASSEMBLER_NAME (decl);
+
if (!asm_name)
return;
+#ifdef HALF_PIC_DEBUG
+ if (HALF_PIC_DEBUG)
+ {
+ if (HALF_PIC_DEBUG)
+ fprintf (stderr, "\n========== Half_pic_encode %.*s\n",
+ IDENTIFIER_LENGTH (asm_name),
+ IDENTIFIER_POINTER (asm_name));
+ debug_tree (decl);
+ }
+#endif
+
+ /* If this is not an external reference, it can't be half-pic. */
+ if (!TREE_EXTERNAL (decl) && (code != VAR_DECL || !TREE_PUBLIC (decl)))
+ return;
+
ptr = half_pic_hash (IDENTIFIER_POINTER (asm_name),
IDENTIFIER_LENGTH (asm_name),
TRUE);
#ifdef HALF_PIC_DEBUG
if (HALF_PIC_DEBUG)
- fprintf (stderr, "\n========== Half_pic_encode %.*s\n",
+ fprintf (stderr, "\n%.*s is half-pic\n",
IDENTIFIER_LENGTH (asm_name),
IDENTIFIER_POINTER (asm_name));
#endif
case CONST:
{
rtx offset = const0_rtx;
- addr = eliminate_constant_term (addr, &offset);
+ addr = eliminate_constant_term (XEXP (addr, 0), &offset);
if (GET_CODE (addr) != SYMBOL_REF)
return FALSE;
}