diff --git a/gcc/config/mmix/mmix.cc b/gcc/config/mmix/mmix.cc index 13b6c39c76785cea114e43679c43a1c1ae8fe36f..e167ffcb6609c93ba047cc08521b14c701347d5c 100644 --- a/gcc/config/mmix/mmix.cc +++ b/gcc/config/mmix/mmix.cc @@ -1586,6 +1586,35 @@ mmix_asm_output_labelref (FILE *stream, const char *name) if (*name == '@') is_extern = 0; + size_t ndots = 0; + for (const char *s = name; *s != 0; s++) + if (*s == '.') + ndots++; + + /* Replace all '.' with '::'. We don't want a '.' as part of an identifier + as that'd be incompatible with mmixal. We also don't want to do things + like overriding the default "%s.%lu" by '#define ASM_PN_FORMAT "%s::%lu"' + as that format will show up in warnings and error messages. The default + won't show up in warnings and errors, as there are mechanisms in place to + strip that (but that only handles the default format). FIXME: Make sure + no ":" is seen in the object file; we don't really want that mmixal + feature visible there. */ + if (ndots > 0) + { + char *colonized_name = XALLOCAVEC (char, strlen (name) + 1 + ndots); + + char *cs = colonized_name; + const char *s = name; + for (; *s != 0; s++) + { + if (*s == '.') + *cs++ = ':'; + *cs++ = *s; + } + *cs = 0; + name = colonized_name; + } + asm_fprintf (stream, "%s%U%s", is_extern && TARGET_TOPLEVEL_SYMBOLS ? ":" : "", name); diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index 47db27594d7aa057ef3b19fca26d2904f03fb1c8..44669e195b4ac6676339d622d01cf0cbfec88fa2 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -656,11 +656,11 @@ typedef struct { int regs; int lib; } CUMULATIVE_ARGS; #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ sprintf (LABEL, "*%s:%ld", PREFIX, (long)(NUM)) -/* Insert "::"; these are rarer than internal labels. FIXME: Make sure no - ":" is seen in the object file; we don't really want that mmixal - feature visible there. We don't want the default, which uses a dot; - that'd be incompatible with mmixal. */ -#define ASM_PN_FORMAT "%s::%lu" +/* Override the default, which looks at NO_DOT_IN_LABEL and NO_DOLLAR_IN_LABEL. + We want the real default "%s.%lu" in dumps and compiler messages, but the + actual assembly code format is adjusted to the effect of "%s::%lu". See + mmix_asm_output_labelref. */ +#define ASM_PN_FORMAT "%s.%lu" #define ASM_OUTPUT_DEF(STREAM, NAME, VALUE) \ mmix_asm_output_def (STREAM, NAME, VALUE)