This is sources Bugzilla
Bugzilla Version 2.17.5
Bugzilla Bug 4701
  Linker fails to adjust segment offset with .bss sections Last modified: 2007-06-29 04:38
     Query page      Enter new bug
Bug#: 4701   Hardware:   Reporter: Jürg Billeter <j@bitron.ch>
Host: Target: Build:
Product:     Add CC:
Component:   Version:   CC:
Remove selected CCs
Status: RESOLVED   Priority:  
Resolution: FIXED   Severity:  
Assigned To: unassigned@sources.redhat.com   Target Milestone:  
Summary:
Keywords:

Attachment Description Type Created Actions
bug.tar.bz2 A testcase application/octet-stream 2007-06-28 02:37 Edit None
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 4701 depends on: Show dependency tree
Show dependency graph
Bug 4701 blocks:

Additional Comments:


Leave as RESOLVED FIXED
Reopen bug
Mark bug as VERIFIED

View Bug Activity   |   Format For Printing


Description:   Last confirmed: 0000-00-00 00:00 Opened: 2007-06-26 20:02
Trying to run the umount binary linked to the shared klibc library on Linux
x86_64 results in an immediate kill by SIGKILL. I've traced the problem back to
the commit on 2007-05-30 13:38:50 UTC, src/bfd/elf.c r1.389 => r.1390, see
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf.c.diff?r1=1.389&r2=1.390&cvsroot=src&f=h
for the change. Applying the reverse patch on top of the Linux binutils
2.17.50.0.17 fixes the issue.

This has been tested with klibc 1.5 and gcc 4.2-20070620 on Linux 2.6.21.5

The Linux binutils 2.17.50.0.17 is affected by this problem, 2.17.50.0.16 was ok.

------- Additional Comment #1 From H.J. Lu 2007-06-26 22:54 -------
I need more info. Please tell me how I can reproduce on Fedora Core 6
or Fedora 7.

------- Additional Comment #2 From Jürg Billeter 2007-06-27 07:20 -------
I don't have Fedora here but you should be able to reproduce it as follows on
any Linux x86_64 system with binutils 2.17.50.0.17:

Download and extract klibc-1.5,
http://www.kernel.org/pub/linux/libs/klibc/klibc-1.5.tar.bz2

Download and extract linux-2.6.21 within the klibc-1.5 directory and rename the
linux-2.6.21 subdirectory to "linux".

Setup the kernel headers: make include/linux/version.h && ln -s asm-x86_64
include/asm

Call make in the klibc-1.5 directory to build klibc and utils.
Install the library: cp usr/klibc/klibc-*.so /lib
Run umount: usr/utils/shared/umount

This should display the usage of umount with a correctly working binutils
version and display "Killed" with a binutils version affected by this bug, e.g.
binutils 2.17.50.0.17. Tested with gcc-4.1-20070528 and gcc-4.2-20070620

------- Additional Comment #3 From H.J. Lu 2007-06-27 18:09 -------
A patch is posted at

http://sourceware.org/ml/binutils/2007-06/msg00298.html

------- Additional Comment #4 From H.J. Lu 2007-06-28 02:37 -------
Created an attachment (id=1903)
A testcase

I got

bash-3.1$ make
gcc -m32    -c -o x.o x.c
gcc -m32    -c -o bss.o bss.c
./ld  -m elf_i386 -T bss.t -shared -o libbss.so bss.o
gcc -m32 -Wl,-z,nocopyreloc,-R,. -o x x.o libbss.so
./x
./x: error while loading shared libraries: libbss.so: ELF load command
address/offset not properly aligned
make: *** [all] Error 127
bash-3.1$ readelf -Sl libbss.so
There are 10 section headers, starting at offset 0x19c:

Section Headers:
  [Nr] Name		 Type		 Addr	  Off	 Size	ES Flg Lk Inf
Al
  [ 0]			 NULL		 00000000 000000 000000 00	0   0 
0
  [ 1] .hash		 HASH		 000000b4 0000b4 000014 04   A	2   0 
4
  [ 2] .dynsym		 DYNSYM 	 000000c8 0000c8 000020 10   A	3   1 
4
  [ 3] .dynstr		 STRTAB 	 000000e8 0000e8 000005 00   A	0   0 
1
  [ 4] .dynamic 	 DYNAMIC	 000000f0 0000f0 000058 08  WA	3   0 
4
  [ 5] .got.plt 	 PROGBITS	 00000148 000148 00000c 04  WA	0   0 
4
  [ 6] .bss		 NOBITS 	 00010000 000154 000004 00  WA	0   0 
4
  [ 7] .shstrtab	 STRTAB 	 00000000 000154 000048 00	0   0 
1
  [ 8] .symtab		 SYMTAB 	 00000000 00032c 0000b0 10	9  10 
4
  [ 9] .strtab		 STRTAB 	 00000000 0003dc 00002a 00	0   0 
1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Elf file type is DYN (Shared object file)
Entry point 0xf0
There are 4 program headers, starting at offset 52

Program Headers:
  Type		 Offset   VirtAddr   PhysAddr	FileSiz MemSiz	Flg Align
  LOAD		 0x000000 0x00000000 0x00000000 0x00154 0x00154 RW  0x1000
  LOAD		 0x000154 0x00010000 0x00010000 0x00000 0x00004 RW  0x1000
  DYNAMIC	 0x0000f0 0x000000f0 0x000000f0 0x00058 0x00058 RW  0x4
  GNU_STACK	 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00	  .hash .dynsym .dynstr .dynamic .got.plt 
   01	  .bss 
   02	  .dynamic 
   03	  
bash-3.1$ 

------- Additional Comment #5 From H.J. Lu 2007-06-29 04:38 -------
Fixed by

http://sourceware.org/ml/binutils/2007-06/msg00329.html

     Query page      Enter new bug
Actions: New | Query | bug # | Reports | Requests   New Account | Log In