aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2023-08-27 12:12:56 +0100
committerIain Sandoe <iain@sandoe.co.uk>2023-09-04 11:21:51 +0100
commit9018cd0fc6f0bdbb44e6505338af0aee5a733fa5 (patch)
tree4462d2c65ff7af0e5f9d5030fe70301eeed07adf
parentd99a868a9b100ab5a4b270a1acece60b5b6153a3 (diff)
downloadgcc-9018cd0fc6f0bdbb44e6505338af0aee5a733fa5.zip
gcc-9018cd0fc6f0bdbb44e6505338af0aee5a733fa5.tar.gz
gcc-9018cd0fc6f0bdbb44e6505338af0aee5a733fa5.tar.bz2
Darwin, machopic: Debug printer for macho symbol flags.
There are now quite a few symbol flags, so it is sometimes useful to get them in a text form, rather than decoding the hex number printed by debug_rtx(). Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/ChangeLog: * config/darwin.cc (dump_machopic_symref_flags): New. (debug_machopic_symref_flags): New.
-rw-r--r--gcc/config/darwin.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/config/darwin.cc b/gcc/config/darwin.cc
index efbcb38..0d53e97 100644
--- a/gcc/config/darwin.cc
+++ b/gcc/config/darwin.cc
@@ -258,6 +258,45 @@ name_needs_quotes (const char *name)
return 0;
}
+DEBUG_FUNCTION void
+dump_machopic_symref_flags (FILE *dump, rtx sym_ref)
+{
+ unsigned long flags = SYMBOL_REF_FLAGS (sym_ref);
+
+ fprintf (dump, "flags: %08lx %c%c%c%c%c%c%c",
+ flags,
+ (MACHO_SYMBOL_STATIC_P (sym_ref) ? 's' : '-'),
+ (MACHO_SYMBOL_INDIRECTION_P (sym_ref) ? 'I' : '-'),
+ (MACHO_SYMBOL_LINKER_VIS_P (sym_ref) ? 'l' : '-'),
+ (MACHO_SYMBOL_HIDDEN_VIS_P (sym_ref) ? 'h' : '-'),
+ (MACHO_SYMBOL_DEFINED_P (sym_ref) ? 'd' : '-'),
+ (MACHO_SYMBOL_MUST_INDIRECT_P (sym_ref) ? 'i' : '-'),
+ (MACHO_SYMBOL_VARIABLE_P (sym_ref) ? 'v' : '-'));
+
+#if (DARWIN_X86)
+ fprintf (dump, "%c%c%c%c",
+ (SYMBOL_REF_STUBVAR_P (sym_ref) ? 'S' : '-'),
+ (SYMBOL_REF_DLLEXPORT_P (sym_ref) ? 'X' : '-'),
+ (SYMBOL_REF_DLLIMPORT_P (sym_ref) ? 'I' : '-'),
+ (SYMBOL_REF_FAR_ADDR_P (sym_ref) ? 'F' : '-'));
+#endif
+
+ fprintf (dump, "%c%c%c%03u%c%c%c\n",
+ (SYMBOL_REF_ANCHOR_P (sym_ref) ? 'a' : '-'),
+ (SYMBOL_REF_HAS_BLOCK_INFO_P (sym_ref) ? 'b' : '-'),
+ (SYMBOL_REF_EXTERNAL_P (sym_ref) ? 'e' : '-'),
+ (unsigned)SYMBOL_REF_TLS_MODEL (sym_ref),
+ (SYMBOL_REF_SMALL_P (sym_ref) ? 'm' : '-'),
+ (SYMBOL_REF_LOCAL_P (sym_ref) ? 'l' : '-'),
+ (SYMBOL_REF_FUNCTION_P (sym_ref) ? 'f' : '-'));
+}
+
+DEBUG_FUNCTION void
+debug_machopic_symref_flags (rtx sym_ref)
+{
+ dump_machopic_symref_flags (stderr, sym_ref);
+}
+
/* Return true if SYM_REF can be used without an indirection. */
int
machopic_symbol_defined_p (rtx sym_ref)