aboutsummaryrefslogtreecommitdiff
path: root/gas/config/obj-elf.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2004-12-16 13:23:22 +0000
committerJan Beulich <jbeulich@novell.com>2004-12-16 13:23:22 +0000
commit7a6d0b32af1797bcf3713165118d98f15e6c6a82 (patch)
treeb1c87e7a6f7c7c4476e304a1dae17901907bdea7 /gas/config/obj-elf.c
parentbcf32829aff66021b9309b1f738d54f24dfa6a8e (diff)
downloadgdb-7a6d0b32af1797bcf3713165118d98f15e6c6a82.zip
gdb-7a6d0b32af1797bcf3713165118d98f15e6c6a82.tar.gz
gdb-7a6d0b32af1797bcf3713165118d98f15e6c6a82.tar.bz2
gas/
2004-12-15 Jan Beulich <jbeulich@novell.com> * config/obj-elf.c (obj_elf_change_section): Only set type and attributes on new sections. Emit warning when type of re-declared section doesn't match. gas/testsuite/ 2004-12-15 Jan Beulich <jbeulich@novell.com> * gas/elf/section5.[els]: New.
Diffstat (limited to 'gas/config/obj-elf.c')
-rw-r--r--gas/config/obj-elf.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index b4c3a5a..155eaff 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -622,11 +622,6 @@ obj_elf_change_section (const char *name,
attr |= ssect->attr;
}
- if (type != SHT_NULL)
- elf_section_type (sec) = type;
- if (attr != 0)
- elf_section_flags (sec) = attr;
-
/* Convert ELF type and flags to BFD flags. */
flags = (SEC_RELOC
| ((attr & SHF_WRITE) ? 0 : SEC_READONLY)
@@ -647,6 +642,9 @@ obj_elf_change_section (const char *name,
{
symbolS *secsym;
+ elf_section_type (sec) = type;
+ elf_section_flags (sec) = attr;
+
/* Prevent SEC_HAS_CONTENTS from being inadvertently set. */
if (type == SHT_NOBITS)
seg_info (sec)->bss = 1;
@@ -663,19 +661,26 @@ obj_elf_change_section (const char *name,
else
symbol_table_insert (section_symbol (sec));
}
- else if (attr != 0)
+ else
{
- /* If section attributes are specified the second time we see a
- particular section, then check that they are the same as we
- saw the first time. */
- if (((old_sec->flags ^ flags)
- & (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
- | SEC_EXCLUDE | SEC_SORT_ENTRIES | SEC_MERGE | SEC_STRINGS
- | SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD
- | SEC_THREAD_LOCAL)))
- as_warn (_("ignoring changed section attributes for %s"), name);
- if ((flags & SEC_MERGE) && old_sec->entsize != (unsigned) entsize)
- as_warn (_("ignoring changed section entity size for %s"), name);
+ if (type != SHT_NULL
+ && (unsigned) type != elf_section_type (old_sec))
+ as_warn (_("ignoring changed section type for %s"), name);
+
+ if (attr != 0)
+ {
+ /* If section attributes are specified the second time we see a
+ particular section, then check that they are the same as we
+ saw the first time. */
+ if (((old_sec->flags ^ flags)
+ & (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
+ | SEC_EXCLUDE | SEC_SORT_ENTRIES | SEC_MERGE | SEC_STRINGS
+ | SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD
+ | SEC_THREAD_LOCAL)))
+ as_warn (_("ignoring changed section attributes for %s"), name);
+ if ((flags & SEC_MERGE) && old_sec->entsize != (unsigned) entsize)
+ as_warn (_("ignoring changed section entity size for %s"), name);
+ }
}
#ifdef md_elf_section_change_hook