mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 17:18:24 +08:00
Check for changed section attributes.
This commit is contained in:
@ -1,5 +1,8 @@
|
|||||||
2000-04-19 Alan Modra <alan@linuxcare.com.au>
|
2000-04-19 Alan Modra <alan@linuxcare.com.au>
|
||||||
|
|
||||||
|
* config/obj-elf.c (obj_elf_change_section): Check for changed
|
||||||
|
section attributes.
|
||||||
|
|
||||||
* Makefile.am: (CPU_MULTI_VALID): Remove.
|
* Makefile.am: (CPU_MULTI_VALID): Remove.
|
||||||
(MULTI_CPU_TYPES): Define.
|
(MULTI_CPU_TYPES): Define.
|
||||||
(MULTI_CPU_OBJ_VALID): Define.
|
(MULTI_CPU_OBJ_VALID): Define.
|
||||||
@ -11,7 +14,7 @@
|
|||||||
|
|
||||||
2000-04-19 Michael Sokolov <msokolov@ivan.Harhan.ORG>
|
2000-04-19 Michael Sokolov <msokolov@ivan.Harhan.ORG>
|
||||||
|
|
||||||
* Makefile.am (FLEX, LEX): Get them from configure.
|
* Makefile.am (YACC, LEX): Get them from configure.
|
||||||
|
|
||||||
2000-04-18 H.J. Lu (hjl@gnu.org)
|
2000-04-18 H.J. Lu (hjl@gnu.org)
|
||||||
|
|
||||||
|
@ -617,8 +617,10 @@ obj_elf_change_section (name, type, attr, push)
|
|||||||
char *name;
|
char *name;
|
||||||
int type, attr, push;
|
int type, attr, push;
|
||||||
{
|
{
|
||||||
int new_sec;
|
asection *old_sec;
|
||||||
segT sec;
|
segT sec;
|
||||||
|
flagword flags;
|
||||||
|
int i;
|
||||||
|
|
||||||
#ifdef md_flush_pending_output
|
#ifdef md_flush_pending_output
|
||||||
md_flush_pending_output ();
|
md_flush_pending_output ();
|
||||||
@ -639,49 +641,57 @@ obj_elf_change_section (name, type, attr, push)
|
|||||||
previous_section = now_seg;
|
previous_section = now_seg;
|
||||||
previous_subsection = now_subseg;
|
previous_subsection = now_subseg;
|
||||||
|
|
||||||
new_sec = bfd_get_section_by_name (stdoutput, name) == NULL;
|
old_sec = bfd_get_section_by_name (stdoutput, name);
|
||||||
sec = subseg_new (name, 0);
|
sec = subseg_new (name, 0);
|
||||||
|
|
||||||
if (new_sec)
|
/* See if this is one of the special sections. */
|
||||||
{
|
for (i = 0; special_sections[i].name != NULL; i++)
|
||||||
flagword flags;
|
if (strcmp (name, special_sections[i].name) == 0)
|
||||||
symbolS *secsym;
|
{
|
||||||
int i;
|
if (type == SHT_NULL)
|
||||||
|
type = special_sections[i].type;
|
||||||
/* See if this is one of the special sections. */
|
else if (type != special_sections[i].type)
|
||||||
for (i = 0; special_sections[i].name != NULL; i++)
|
{
|
||||||
if (strcmp (name, special_sections[i].name) == 0)
|
if (old_sec == NULL)
|
||||||
{
|
|
||||||
if (type == SHT_NULL)
|
|
||||||
type = special_sections[i].type;
|
|
||||||
else if (type != special_sections[i].type)
|
|
||||||
as_warn (_("Setting incorrect section type for %s"), name);
|
|
||||||
|
|
||||||
if ((attr &~ special_sections[i].attributes) != 0)
|
|
||||||
{
|
{
|
||||||
/* As a GNU extension, we permit a .note section to be
|
as_warn (_("Setting incorrect section type for %s"), name);
|
||||||
allocatable. If the linker sees an allocateable .note
|
}
|
||||||
section, it will create a PT_NOTE segment in the output
|
else
|
||||||
file. */
|
{
|
||||||
if (strcmp (name, ".note") != 0
|
as_warn (_("Ignoring incorrect section type for %s"), name);
|
||||||
|| attr != SHF_ALLOC)
|
type = special_sections[i].type;
|
||||||
as_warn (_("Setting incorrect section attributes for %s"),
|
|
||||||
name);
|
|
||||||
}
|
}
|
||||||
attr |= special_sections[i].attributes;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
if ((attr &~ special_sections[i].attributes) != 0
|
||||||
|
&& old_sec == NULL)
|
||||||
|
{
|
||||||
|
/* As a GNU extension, we permit a .note section to be
|
||||||
|
allocatable. If the linker sees an allocateable .note
|
||||||
|
section, it will create a PT_NOTE segment in the output
|
||||||
|
file. */
|
||||||
|
if (strcmp (name, ".note") != 0
|
||||||
|
|| attr != SHF_ALLOC)
|
||||||
|
as_warn (_("Setting incorrect section attributes for %s"),
|
||||||
|
name);
|
||||||
|
}
|
||||||
|
attr |= special_sections[i].attributes;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Convert ELF type and flags to BFD flags. */
|
/* Convert ELF type and flags to BFD flags. */
|
||||||
flags = (SEC_RELOC
|
flags = (SEC_RELOC
|
||||||
| ((attr & SHF_WRITE) ? 0 : SEC_READONLY)
|
| ((attr & SHF_WRITE) ? 0 : SEC_READONLY)
|
||||||
| ((attr & SHF_ALLOC) ? SEC_ALLOC : 0)
|
| ((attr & SHF_ALLOC) ? SEC_ALLOC : 0)
|
||||||
| (((attr & SHF_ALLOC) && type != SHT_NOBITS) ? SEC_LOAD : 0)
|
| (((attr & SHF_ALLOC) && type != SHT_NOBITS) ? SEC_LOAD : 0)
|
||||||
| ((attr & SHF_EXECINSTR) ? SEC_CODE : 0));
|
| ((attr & SHF_EXECINSTR) ? SEC_CODE : 0));
|
||||||
#ifdef md_elf_section_flags
|
#ifdef md_elf_section_flags
|
||||||
flags = md_elf_section_flags (flags, attr, type);
|
flags = md_elf_section_flags (flags, attr, type);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (old_sec == NULL)
|
||||||
|
{
|
||||||
|
symbolS *secsym;
|
||||||
|
|
||||||
/* Prevent SEC_HAS_CONTENTS from being inadvertently set. */
|
/* Prevent SEC_HAS_CONTENTS from being inadvertently set. */
|
||||||
if (type == SHT_NOBITS)
|
if (type == SHT_NOBITS)
|
||||||
seg_info (sec)->bss = 1;
|
seg_info (sec)->bss = 1;
|
||||||
@ -695,9 +705,19 @@ obj_elf_change_section (name, type, attr, push)
|
|||||||
else
|
else
|
||||||
symbol_table_insert (section_symbol (sec));
|
symbol_table_insert (section_symbol (sec));
|
||||||
}
|
}
|
||||||
|
else 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))
|
||||||
|
as_warn (_("Ignoring changed section attributes for %s"), name);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef md_elf_section_change_hook
|
#ifdef md_elf_section_change_hook
|
||||||
md_elf_section_change_hook ();
|
md_elf_section_change_hook ();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user