Bug 4712 - BFD: section .data1/.bss can't be allocated in segment 0
Summary: BFD: section .data1/.bss can't be allocated in segment 0
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.17
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-29 15:46 UTC by Pawel Sikora
Modified: 2007-07-02 07:25 UTC (History)
1 user (show)

See Also:
Host:
Target: sparc-sun-solaris2.9
Build:
Last reconfirmed:


Attachments
testcase #1 (15.20 KB, application/octet-stream)
2007-06-29 15:48 UTC, Pawel Sikora
Details
testcase #2 (231.36 KB, application/octet-stream)
2007-06-29 15:48 UTC, Pawel Sikora
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Sikora 2007-06-29 15:46:56 UTC
after switching from 2.17.50.0.12 to 2.17.50.0.17 i'm observing
assertion failures during stripping native solaris libs.

$ sparc-sun-solaris2.9-strip libFS.so.5
BFD: BFD (Linux/GNU Binutils) 2.17.50.0.17.20070615 assertion fail elf.c:6234
BFD: st53IDU9: section `.data1' can't be allocated in segment 0
sparc-sun-solaris2.9-strip: st53IDU9: Bad value
BFD: st53IDU9: section `.data1' can't be allocated in segment 0
sparc-sun-solaris2.9-strip: st53IDU9: Bad value

$ sparc-sun-solaris2.9-strip libX11.so.4
BFD: BFD (Linux/GNU Binutils) 2.17.50.0.17.20070615 assertion fail elf.c:6234
BFD: stz6mGpK: section `.bss' can't be allocated in segment 0
sparc-sun-solaris2.9-strip: stz6mGpK: Bad value
BFD: stz6mGpK: section `.bss' can't be allocated in segment 0
sparc-sun-solaris2.9-strip: stz6mGpK: Bad value
Comment 1 Pawel Sikora 2007-06-29 15:48:21 UTC
Created attachment 1904 [details]
testcase #1
Comment 2 Pawel Sikora 2007-06-29 15:48:50 UTC
Created attachment 1905 [details]
testcase #2
Comment 3 Pawel Sikora 2007-06-29 15:51:29 UTC
native solaris stripper works fine.

$ strip -V
strip: Software Generation Utilities (SGU) Solaris-ELF (4.0)

$ uname -a
SunOS hermes 5.9 Generic_117171-07 sun4u sparc SUNW,Sun-Blade-1500
Comment 4 Alan Modra 2007-06-30 01:12:41 UTC
Neither of the attached files have correct program headers.  For libFS.so,

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000000 0x00000000 0x00000000 0x07dbf 0x07dbf R E 0x4
  LOAD           0x0080b4 0x00000000 0x00000000 0x18b5d 0x18b5d RWE 0x2000
  DYNAMIC        0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4
  LOOS+ffffffb   0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

Notice how both load segments have p_vaddr of zero.  Strictly speaking, this
means they overlap.  Obviously the sun loader ignores the addresses..
Comment 5 Alan Modra 2007-07-01 05:37:56 UTC
I think http://sourceware.org/ml/binutils/2006-12/msg00165.html should also be
adjusting lma.

Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.394
diff -u -p -r1.394 elf.c
--- bfd/elf.c	29 Jun 2007 16:29:15 -0000	1.394
+++ bfd/elf.c	1 Jul 2007 05:08:52 -0000
@@ -4373,7 +4373,7 @@ assign_file_positions_for_load_sections 
       else if (m->count == 0)
 	p->p_paddr = 0;
       else
-	p->p_paddr = m->sections[0]->lma;
+	p->p_paddr = m->sections[0]->lma - m->p_vaddr_offset;
 
       if (p->p_type == PT_LOAD
 	  && (abfd->flags & D_PAGED) != 0)

At least, doing so allows strip to process these funky files.