aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2010-01-13 14:08:54 +0000
committerNick Clifton <nickc@redhat.com>2010-01-13 14:08:54 +0000
commit52b010e4424ced5700579389375a536b614f8b19 (patch)
tree67dca4c0f96d271dfa9bf01d4ff329419763f674 /gas/config
parent11db68fd8df09b071049208a7e7b64e3b1cb8946 (diff)
downloadgdb-52b010e4424ced5700579389375a536b614f8b19.zip
gdb-52b010e4424ced5700579389375a536b614f8b19.tar.gz
gdb-52b010e4424ced5700579389375a536b614f8b19.tar.bz2
* config/tc-h8300.c (h8300_elf_section): New function - issue a
warning message if a new section is created without setting any attributes for it. (md_pseudo_table): Intercept section creation pseudos. (md_pcrel_from): Replace abort with an error message. * config/obj-elf.c (obj_elf_section_name): Export this function. * config/obj-elf.h (obj_elf_section_name): Prototype. * gas/elf/section0.d: Skip this test for the h8300. * gas/elf/section1.d: Likewise. * gas/elf/section6.d: Likewise. * gas/elf/elf.exp: Skip section2 and section5 tests when the target is the h8300. * ld-scrips/sort.exp: Skip these tests when the target is the h8300.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/obj-elf.c2
-rw-r--r--gas/config/obj-elf.h1
-rw-r--r--gas/config/tc-h8300.c56
3 files changed, 56 insertions, 3 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 0948702..4bd4514 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -855,7 +855,7 @@ obj_elf_section_word (char *str, size_t len, int *type)
}
/* Get name of section. */
-static char *
+char *
obj_elf_section_name (void)
{
char *name;
diff --git a/gas/config/obj-elf.h b/gas/config/obj-elf.h
index dc8284f..c734aab 100644
--- a/gas/config/obj-elf.h
+++ b/gas/config/obj-elf.h
@@ -164,6 +164,7 @@ extern void elf_file_symbol (const char *, int);
extern void obj_elf_section_change_hook (void);
extern void obj_elf_section (int);
+extern char * obj_elf_section_name (void);
extern void obj_elf_previous (int);
extern void obj_elf_version (int);
extern void obj_elf_common (int);
diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
index 92c0d57..62af180 100644
--- a/gas/config/tc-h8300.c
+++ b/gas/config/tc-h8300.c
@@ -139,6 +139,48 @@ pint (int arg ATTRIBUTE_UNUSED)
cons (Hmode ? 4 : 2);
}
+/* Like obj_elf_section, but issues a warning for new
+ sections which do not have an attribute specification. */
+
+static void
+h8300_elf_section (int push)
+{
+ static const char * known_data_sections [] = { ".rodata", ".tdata", ".tbss" };
+ static const char * known_data_prefixes [] = { ".debug", ".gnu.warning" };
+ char * saved_ilp = input_line_pointer;
+ char * name;
+
+ name = obj_elf_section_name ();
+ if (name == NULL)
+ return;
+
+ if (* input_line_pointer != ','
+ && bfd_get_section_by_name (stdoutput, name) == NULL)
+ {
+ signed int i;
+
+ /* Ignore this warning for well known data sections. */
+ for (i = ARRAY_SIZE (known_data_sections); i--;)
+ if (strcmp (name, known_data_sections[i]) == 0)
+ break;
+
+ if (i < 0)
+ for (i = ARRAY_SIZE (known_data_prefixes); i--;)
+ if (strncmp (name, known_data_prefixes[i],
+ strlen (known_data_prefixes[i])) == 0)
+ break;
+
+ if (i < 0)
+ as_warn (_("new section '%s' defined without attributes - this might cause problems"), name);
+ }
+
+ /* FIXME: We ought to free the memory allocated by obj_elf_section_name()
+ for 'name', but we do not know if it was taken from the obstack, via
+ demand_copy_C_string(), or xmalloc()ed. */
+ input_line_pointer = saved_ilp;
+ obj_elf_section (push);
+}
+
/* This table describes all the machine specific pseudo-ops the assembler
has to support. The fields are:
pseudo-op name without dot
@@ -165,6 +207,14 @@ const pseudo_typeS md_pseudo_table[] =
{"import", s_ignore, 0},
{"page", listing_eject, 0},
{"program", s_ignore, 0},
+
+#ifdef OBJ_ELF
+ {"section", h8300_elf_section, 0},
+ {"section.s", h8300_elf_section, 0},
+ {"sect", h8300_elf_section, 0},
+ {"sect.s", h8300_elf_section, 0},
+#endif
+
{0, 0, 0}
};
@@ -2139,9 +2189,11 @@ md_number_to_chars (char *ptr, valueT use, int nbytes)
}
long
-md_pcrel_from (fixS *fixP ATTRIBUTE_UNUSED)
+md_pcrel_from (fixS *fixp)
{
- abort ();
+ as_bad_where (fixp->fx_file, fixp->fx_line,
+ _("Unexpected reference to a symbol in a non-code section"));
+ return 0;
}
arelent *