This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Special ELF section flags vs. linker-specified bfd flags


On Thu, Oct 19, 2006 at 12:29:15PM -0700, H. J. Lu wrote:
> On Thu, Oct 19, 2006 at 12:20:35PM -0700, H. J. Lu wrote:
> > On Thu, Oct 19, 2006 at 07:12:33PM +0100, Richard Sandiford wrote:
> > > "H. J. Lu" <hjl@lucon.org> writes:
> > > > "makec check" failed in ld on Linux/x86-64:
> > > >
> > > > FAIL: Run with libdl3a.so
> > > > FAIL: Run with libdl3b.so
> > > > FAIL: Run with libdl3c.so
> > > > ...
> > > > ERROR: tmpdir/3.x: nm failed
> > > > ERROR: tmpdir/4.x: nm failed
> > > > ERROR: tmpdir/5.x: nm failed
> > > 
> > > Hmm, it works fine for me on the same target.  What do the logs say?
> > > 
> > 
> > I see those on the current FC5/x86-64. I got
> > 
> > /export/build/gnu/binutils-last/build-x86_64-linux/ld/../binutils/nm-new
> > --demangle tmpdir/3.x >tmpdir/nm.out BFD: tmpdir/3.x: no group info for
> > section .rodata
> > ERROR: tmpdir/3.x: nm failed
> > UNRESOLVED: selective4
> 
> We don't want to copy all input section flags to output section.
> For example, we don't want SHF_GROUP in output section in a DSO
> or an executable.
> 

This patch copies OS/PROC specific flags from input section to output
section. Is it the best way?

I also changed elf_section_type (osec) == SHT_NULL to assert since
none SHT_NULL type may be a linker error.


H.J.
-----
2006-10-19  H.J. Lu  <hongjiu.lu@intel.com>

	* elf.c (_bfd_elf_init_private_section_data): Assert output
	section ELF type instead of check if it is SHT_NULL.  Copy
	OS/PROC specific flags from input section to output section.

--- bfd/elf.c.stabs	2006-10-19 09:28:18.000000000 -0700
+++ bfd/elf.c	2006-10-19 12:55:05.000000000 -0700
@@ -5977,9 +5977,17 @@ _bfd_elf_init_private_section_data (bfd 
      output BFD section flags have been set to something different.
      elf_fake_sections will set ELF section type based on BFD
      section flags.  */
-  if (osec->flags == isec->flags
-      || (osec->flags == 0 && elf_section_type (osec) == SHT_NULL))
-    elf_section_type (osec) = elf_section_type (isec);
+  if (osec->flags == isec->flags || !osec->flags)
+    {
+      BFD_ASSERT (osec->flags == isec->flags 
+		  || (!osec->flags
+		      && elf_section_type (osec) == SHT_NULL));
+      elf_section_type (osec) = elf_section_type (isec);
+    }
+
+  /* FIXME: Is this correct for all OS/PROC specific flags?  */
+  elf_section_flags (osec) |= (elf_section_flags (isec)
+			       & (SHF_MASKOS | SHF_MASKPROC));
 
   /* Set things up for objcopy and relocatable link.  The output
      SHT_GROUP section will have its elf_next_in_group pointing back


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]