diff options
author | Alan Modra <amodra@gmail.com> | 2014-06-16 11:04:04 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2014-06-16 12:34:45 +0930 |
commit | 85024cd8bcb93f4112470ecdbd6c10fc2aea724f (patch) | |
tree | 5d4ede43c60efe30ac0db22aa5a2cbe853938a19 /gas/config | |
parent | 97d24fbbf5300d5b03e48018454335772d9304e8 (diff) | |
download | gdb-85024cd8bcb93f4112470ecdbd6c10fc2aea724f.zip gdb-85024cd8bcb93f4112470ecdbd6c10fc2aea724f.tar.gz gdb-85024cd8bcb93f4112470ecdbd6c10fc2aea724f.tar.bz2 |
Run write_object_file after errors
This is to fix unitialised memory access when printing listings.
Many targets don't initialise parts of insn frags or data frags that
have fixups, relying on md_apply_fix to finalise the frag. Which is
fine normally, but means we need to run write_object_file after
errors, for listings. Otherwise MALLOC_PERTURB_=1 causes errors like:
x86_64-linux +FAIL: i386 mpx-inval-1
x86_64-linux +FAIL: i386 inval-equ-1
x86_64-linux +FAIL: i386 x86-64-mpx-inval-1
Running write_object_file after errors requires some tweaking to the
testsuite, since we then get extra errors reported from md_apply_fix.
gas/
* write.h (subsegs_finish): Delete declaration.
* write.c (subsegs_finish): Make static.
(write_object_file): Call subsegs_finish from here. Don't print
warning and error count here..
* as.c (main): ..do so here instead. Remove dead code for "no
object file generated". Split out count strings to better support
internationalisation. Don't call subsegs_finish. Tidy setting of
"keep_it". Run write_object_file even after errors.
(keep_it): Make static.
* config/obj-elf.c (elf_frob_symbol): Remove assert.
(elf_frob_file_before_adjust): Likewise.
gas/testsuite/
* gas/elf/bad-group.s: Use %function.
* gas/elf/bad-group.err: Expect correct line number. Allow
other errors.
* gas/elf/bad-size.err: Allow other errors. Match expected
error somewhat more rigorously.
* gas/i386/reloc32.l: Allow other errors.
* gas/i386/mpx-inval-1.l: Match applied relocs.
* gas/i386/x86-64-mpx-inval-1.l: Likewise, and nop padding.
* gas/i386/x86-64-mpx-inval-2.l: Match nop padding, and allow
other errors.
* gas/macros/dot.s: Use .balign.
* gas/macros/dot.l: Update alignment output.
* gas/symver/symver6.l: Allow other errors.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/obj-elf.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index e406f7b..e59f27b 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -2120,7 +2120,9 @@ elf_frob_symbol (symbolS *symp, int *puntp) char *p; p = strchr (sy_obj->versioned_name, ELF_VER_CHR); - know (p != NULL); + if (p == NULL) + /* We will have already reported an error about a missing version. */ + *puntp = TRUE; /* This symbol was given a new name with the .symver directive. @@ -2133,14 +2135,15 @@ elf_frob_symbol (symbolS *symp, int *puntp) symbol. However, it's not clear whether it is the best approach. */ - if (! S_IS_DEFINED (symp)) + else if (! S_IS_DEFINED (symp)) { /* Verify that the name isn't using the @@ syntax--this is reserved for definitions of the default version to link against. */ if (p[1] == ELF_VER_CHR) { - as_bad (_("invalid attempt to declare external version name as default in symbol `%s'"), + as_bad (_("invalid attempt to declare external version name" + " as default in symbol `%s'"), sy_obj->versioned_name); *puntp = TRUE; } @@ -2403,8 +2406,7 @@ elf_frob_file_before_adjust (void) p = strchr (symbol_get_obj (symp)->versioned_name, ELF_VER_CHR); - know (p != NULL); - if (p[1] == ELF_VER_CHR && p[2] == ELF_VER_CHR) + if (p != NULL && p[1] == ELF_VER_CHR && p[2] == ELF_VER_CHR) { size_t l = strlen (&p[3]) + 1; memmove (&p[1], &p[3], l); |