From c9cd7160d84bd6219c9cbf155820a255b08f3e26 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 9 May 2005 14:20:52 +0000 Subject: [PATCH] 2005-05-09 H.J. Lu PR 936 * config/tc-sh64.c (sh64_fake_label): New. * config/tc-sh64.h (TC_FAKE_LABEL): New. * doc/internals.texi (TC_FAKE_LABEL): Document. * write.c (TC_FAKE_LABEL): New. (adjust_reloc_syms): Use it. (write_object_file): Likewise. --- gas/ChangeLog | 13 +++++++++++++ gas/config/tc-sh64.c | 15 +++++++++++++++ gas/config/tc-sh64.h | 3 +++ gas/doc/internals.texi | 5 +++++ gas/write.c | 8 ++++++-- 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index cf436858153..a9a6c5fc598 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,16 @@ +2005-05-09 H.J. Lu + + PR 936 + * config/tc-sh64.c (sh64_fake_label): New. + + * config/tc-sh64.h (TC_FAKE_LABEL): New. + + * doc/internals.texi (TC_FAKE_LABEL): Document. + + * write.c (TC_FAKE_LABEL): New. + (adjust_reloc_syms): Use it. + (write_object_file): Likewise. + 2005-05-09 Jan Beulich * config/tc-i386.c (parse_insn): Disallow use of prefix separator diff --git a/gas/config/tc-sh64.c b/gas/config/tc-sh64.c index 54f704f0b07..a7a61fb482c 100644 --- a/gas/config/tc-sh64.c +++ b/gas/config/tc-sh64.c @@ -3513,3 +3513,18 @@ sh64_vtable_inherit (int ignore ATTRIBUTE_UNUSED) input_line_pointer = eol; } +int +sh64_fake_label (const char *name) +{ + size_t len; + + if (strcmp (name, FAKE_LABEL_NAME) == 0) + return 1; + + len = strlen (name); + if (len >= (sizeof (DATALABEL_SUFFIX) - 1)) + return strcmp (&name [len - sizeof (DATALABEL_SUFFIX) + 1], + DATALABEL_SUFFIX) == 0; + + return 0; +} diff --git a/gas/config/tc-sh64.h b/gas/config/tc-sh64.h index 89a7e773743..cbb37791c9b 100644 --- a/gas/config/tc-sh64.h +++ b/gas/config/tc-sh64.h @@ -221,3 +221,6 @@ void shmedia_md_end (void); we have to say we only have minimum byte-size insns. */ #undef DWARF2_LINE_MIN_INSN_LENGTH #define DWARF2_LINE_MIN_INSN_LENGTH 1 + +#define TC_FAKE_LABEL(NAME) sh64_fake_label(NAME) +extern int sh64_fake_label (const char *); diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi index 1770a445244..e75281f1074 100644 --- a/gas/doc/internals.texi +++ b/gas/doc/internals.texi @@ -1019,6 +1019,11 @@ default definition is to accept any name followed by a colon character. Same as TC_START_LABEL, but should be used instead of TC_START_LABEL when LABELS_WITHOUT_COLONS is defined. +@item TC_FAKE_LABEL +@cindex TC_FAKE_LABEL +You may define this macro to control what GAS considers to be a fake +label. The default fake label is FAKE_LABEL_NAME. + @item NO_PSEUDO_DOT @cindex NO_PSEUDO_DOT If you define this macro, GAS will not require pseudo-ops to start with a diff --git a/gas/write.c b/gas/write.c index 5e25e0b50fe..7f4e2d57c78 100644 --- a/gas/write.c +++ b/gas/write.c @@ -97,6 +97,10 @@ #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from (FIX) #endif +#ifndef TC_FAKE_LABEL +#define TC_FAKE_LABEL(NAME) (strcmp ((NAME), FAKE_LABEL_NAME) == 0) +#endif + /* Used to control final evaluation of expressions. */ int finalize_syms = 0; @@ -795,7 +799,7 @@ adjust_reloc_syms (bfd *abfd ATTRIBUTE_UNUSED, = symbol_get_value_expression (sym)->X_add_symbol; const char *name = S_GET_NAME (sym); if (!S_IS_COMMON (new_sym) - && strcmp (name, FAKE_LABEL_NAME) + && !TC_FAKE_LABEL (name) && (!S_IS_EXTERNAL (sym) || S_IS_LOCAL (sym))) as_bad (_("Local symbol `%s' can't be equated to undefined symbol `%s'"), name, S_GET_NAME (new_sym)); @@ -1928,7 +1932,7 @@ write_object_file (void) { const char *name = S_GET_NAME (symp); if (S_IS_COMMON (symp) - && strcmp (name, FAKE_LABEL_NAME) + && !TC_FAKE_LABEL (name) && (!S_IS_EXTERNAL (symp) || S_IS_LOCAL (symp))) { expressionS *e = symbol_get_value_expression (symp); -- 2.30.2