aboutsummaryrefslogtreecommitdiff
path: root/gas/config/obj-elf.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2003-10-24 15:41:23 +0000
committerH.J. Lu <hjl.tools@gmail.com>2003-10-24 15:41:23 +0000
commitea8f8eab209f0cc042c791b73e38484298bfdcf7 (patch)
tree4c72a6704da8a4645245b2692cac59ce5af14640 /gas/config/obj-elf.c
parent7a995eb391ac0ac2b3c59f4dd63d7fdfcb9dc70a (diff)
downloadgdb-ea8f8eab209f0cc042c791b73e38484298bfdcf7.zip
gdb-ea8f8eab209f0cc042c791b73e38484298bfdcf7.tar.gz
gdb-ea8f8eab209f0cc042c791b73e38484298bfdcf7.tar.bz2
2003-10-24 H.J. Lu <hongjiu.lu@intel.com>
* config/obj-elf.c (obj_elf_change_section): Allow SHF_ALLOC for .interp, .strtab and .symtab. Use specified section attributes.
Diffstat (limited to 'gas/config/obj-elf.c')
-rw-r--r--gas/config/obj-elf.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index f0182a2..c9fd1c7 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -641,6 +641,8 @@ obj_elf_change_section (name, type, attr, entsize, group_name, linkonce, push)
if (ssect != NULL)
{
+ bfd_boolean override = FALSE;
+
if (type == SHT_NULL)
type = ssect->type;
else if (type != ssect->type)
@@ -669,7 +671,7 @@ obj_elf_change_section (name, type, attr, entsize, group_name, linkonce, push)
}
}
- if (old_sec == NULL && (attr &~ ssect->attr) != 0)
+ if (old_sec == NULL && (attr & ~ssect->attr) != 0)
{
/* As a GNU extension, we permit a .note section to be
allocatable. If the linker sees an allocatable .note
@@ -682,13 +684,25 @@ obj_elf_change_section (name, type, attr, entsize, group_name, linkonce, push)
something like .rodata.str. */
else if (ssect->suffix_length == -2
&& name[ssect->prefix_length] == '.'
- && (attr &~ ssect->attr &~ SHF_MERGE &~ SHF_STRINGS) == 0)
+ && (attr
+ & ~ssect->attr
+ & ~SHF_MERGE
+ & ~SHF_STRINGS) == 0)
;
+ /* .interp, .strtab and .symtab can have SHF_ALLOC. */
+ else if (attr == SHF_ALLOC
+ && (strcmp (name, ".interp") == 0
+ || strcmp (name, ".strtab") == 0
+ || strcmp (name, ".symtab") == 0))
+ override = TRUE;
else
- as_warn (_("setting incorrect section attributes for %s"),
- name);
+ {
+ as_warn (_("setting incorrect section attributes for %s"),
+ name);
+ override = TRUE;
+ }
}
- if (old_sec == NULL)
+ if (!override && old_sec == NULL)
attr |= ssect->attr;
}