This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: nonfunctional.
- To: Richard Henderson <rth at cygnus dot com>
- Subject: Re: nonfunctional.
- From: Alan Modra <alan at linuxcare dot com dot au>
- Date: Tue, 18 Apr 2000 20:16:45 +1000 (EST)
- cc: Ian Lance Taylor <ian at zembu dot com>, binutils at sourceware dot cygnus dot com
On Tue, 18 Apr 2000, Richard Henderson wrote:
> Won't help here, since the linker won't detect anything.
However, gas can easily detect a change in section flags if that happens
in one input file, which was the case for recent examples of this sort of
problem reported on the binutils list. Something like the following
(completely untested, not even compiled) should do it:
--- gas/config/obj-elf.c~ Tue Feb 29 16:48:03 2000
+++ gas/config/obj-elf.c Tue Apr 18 19:42:28 2000
@@ -617,7 +617,7 @@ obj_elf_change_section (name, type, attr
char *name;
int type, attr, push;
{
- int new_sec;
+ asection *old_sec;
segT sec;
#ifdef md_flush_pending_output
@@ -639,10 +639,27 @@ obj_elf_change_section (name, type, attr
previous_section = now_seg;
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);
- if (new_sec)
+ if (old_sec)
+ {
+ flagword flags;
+ /* Convert ELF type and flags to BFD flags. */
+ flags = (SEC_RELOC
+ | ((attr & SHF_WRITE) ? 0 : SEC_READONLY)
+ | ((attr & SHF_ALLOC) ? SEC_ALLOC : 0)
+ | (((attr & SHF_ALLOC) && type != SHT_NOBITS) ? SEC_LOAD : 0)
+ | ((attr & SHF_EXECINSTR) ? SEC_CODE : 0));
+#ifdef md_elf_section_flags
+ flags = md_elf_section_flags (flags, attr, type);
+#endif
+ if ((old_sec->flags ^ flags)
+ & (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
+ | SEC_EXCLUDE | SEC_SORT_ENTRIES))
+ as_warn (_("Section attributes for %s have changed"), name);
+ }
+ else
{
flagword flags;
symbolS *secsym;
Comments?
--
Linuxcare. Support for the Revolution.