summaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
authorhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-22 01:54:03 +0000
committerhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-22 01:54:03 +0000
commitcd1862289cb7b38e6c7f0552ebf870525710d4d8 (patch)
treedacbdaca2921aa2efeafb9bf75733643142af3ea /gcc/final.c
parent2aa870e4b9e542ace7ace77a22704c9a91b92be4 (diff)
downloadgcc-cd1862289cb7b38e6c7f0552ebf870525710d4d8.tar.gz
PR middle-end/37170
PR middle-end/37280 * final.c (mark_symbol_ref_as_used): New helper function. (output_operand): Instead of just looking inside MEMs for SYMBOL_REFs, use new helper function and for_each_rtx. * varasm.c (assemble_external): Move #ifndef ASM_OUTPUT_EXTERNAL to after weak-handling. Don't mark decls with TREE_STATIC as weak. Make head comment more general. * config/darwin.c (machopic_output_indirection): Handle weak references here, like in assemble_external. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140539 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/gcc/final.c b/gcc/final.c
index a9b51caeeca..e2d9e5a9766 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -3349,6 +3349,31 @@ output_asm_label (rtx x)
assemble_name (asm_out_file, buf);
}
+/* Helper rtx-iteration-function for output_operand. Marks
+ SYMBOL_REFs as referenced through use of assemble_external. */
+
+static int
+mark_symbol_ref_as_used (rtx *xp, void *dummy ATTRIBUTE_UNUSED)
+{
+ rtx x = *xp;
+
+ /* If we have a used symbol, we may have to emit assembly
+ annotations corresponding to whether the symbol is external, weak
+ or has non-default visibility. */
+ if (GET_CODE (x) == SYMBOL_REF)
+ {
+ tree t;
+
+ t = SYMBOL_REF_DECL (x);
+ if (t)
+ assemble_external (t);
+
+ return -1;
+ }
+
+ return 0;
+}
+
/* Print operand X using machine-dependent assembler syntax.
The macro PRINT_OPERAND is defined just to control this function.
CODE is a non-digit that preceded the operand-number in the % spec,
@@ -3369,14 +3394,11 @@ output_operand (rtx x, int code ATTRIBUTE_UNUSED)
gcc_assert (!x || !REG_P (x) || REGNO (x) < FIRST_PSEUDO_REGISTER);
PRINT_OPERAND (asm_out_file, x, code);
- if (x && MEM_P (x) && GET_CODE (XEXP (x, 0)) == SYMBOL_REF)
- {
- tree t;
- x = XEXP (x, 0);
- t = SYMBOL_REF_DECL (x);
- if (t)
- assemble_external (t);
- }
+
+ if (x == NULL_RTX)
+ return;
+
+ for_each_rtx (&x, mark_symbol_ref_as_used, NULL);
}
/* Print a memory reference operand for address X