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.
This commit is contained in:
H.J. Lu 2003-10-24 15:41:23 +00:00
parent 7a995eb391
commit ea8f8eab20
2 changed files with 25 additions and 5 deletions

View File

@ -1,3 +1,9 @@
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.
2003-10-22 Andreas Schwab <schwab@suse.de>
H.J. Lu <hongjiu.lu@intel.com>
Jim Wilson <wilson@specifixinc.com>

View File

@ -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;
}