All of lore.kernel.org
 help / color / mirror / Atom feed
* patch to install unstripped vDSO on disk breaks powerpc kernel build
@ 2008-05-09 17:16 Chris Friesen
  2008-05-09 19:44 ` Roland McGrath
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Friesen @ 2008-05-09 17:16 UTC (permalink / raw)
  To: linuxppc-dev, roland, paulus, benh

I'm using gcc 3.4.3 and binutils 2.15.92.0.2.  I originally saw the 
following problem in 2.6.25 but it's present in git head as well:

   CALL /home/cfriesen/kernels/2.6.25/linux-2.6.25/scripts/checksyscalls.sh
   CHK     include/linux/compile.h
   CALL 
/home/cfriesen/kernels/2.6.25/linux-2.6.25/arch/powerpc/kernel/systbl_chk.sh
   AS      arch/powerpc/kernel/systbl.o
   OBJCOPY arch/powerpc/kernel/vdso64/vdso64.so
BFD: arch/powerpc/kernel/vdso64/vdso64.so: The first section in the 
PT_DYNAMIC segment is not the .dynamic section
/home/cfriesen/bin/ppc64-R9a/bin/ppc64-R9a-objcopy: 
arch/powerpc/kernel/vdso64/vdso64.so: Bad value
BFD: arch/powerpc/kernel/vdso64/vdso64.so: The first section in the 
PT_DYNAMIC segment is not the .dynamic section
/home/cfriesen/bin/ppc64-R9a/bin/ppc64-R9a-objcopy: 
arch/powerpc/kernel/vdso64/vdso64.so: Bad value
make[3]: *** [arch/powerpc/kernel/vdso64/vdso64.so] Error 1
make[2]: *** [arch/powerpc/kernel/vdso64] Error 2
make[1]: *** [arch/powerpc/kernel] Error 2
make: *** [sub-make] Error 2



I installed git and bisected the problem.  It turns out that it's due to 
the following commit:


commit 8150caad02266623b5b9f58088d589f130fccd97
Author: Roland McGrath <roland@redhat.com>
Date:   Tue Oct 2 13:30:04 2007 -0700

[POWERPC] powerpc vDSO: install unstripped copies on disk
This keeps an unstripped copy of the vDSO images built before they are 
stripped and embedded in the kernel.  The unstripped copies get 
installed in $(MODLIB)/vdso/ by "make install".  These files can be 
useful when they contain source-level debugging information.

     Signed-off-by: Roland McGrath <roland@redhat.com>
     Cc: Sam Ravnborg <sam@ravnborg.org>
     Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
     Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
     Signed-off-by: Paul Mackerras <paulus@samba.org>



Anyone have any idea what's going on?


Thanks,

Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: patch to install unstripped vDSO on disk breaks powerpc kernel build
  2008-05-09 17:16 patch to install unstripped vDSO on disk breaks powerpc kernel build Chris Friesen
@ 2008-05-09 19:44 ` Roland McGrath
  2008-05-10  4:43   ` Chris Friesen
  0 siblings, 1 reply; 5+ messages in thread
From: Roland McGrath @ 2008-05-09 19:44 UTC (permalink / raw)
  To: Chris Friesen; +Cc: linuxppc-dev, paulus

I haven't seen that error before.  Can you show the output of {eu-,}readelf -lS
on vdso64.so.dbg, and also on the vdso64.so successfully built when you
revert the patch?


Thanks,
Roland

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: patch to install unstripped vDSO on disk breaks powerpc kernel build
  2008-05-09 19:44 ` Roland McGrath
@ 2008-05-10  4:43   ` Chris Friesen
  2008-05-11  0:40     ` Roland McGrath
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Friesen @ 2008-05-10  4:43 UTC (permalink / raw)
  To: Roland McGrath; +Cc: linuxppc-dev, paulus

[-- Attachment #1: Type: text/plain, Size: 1390 bytes --]

Roland McGrath wrote:
> I haven't seen that error before.  Can you show the output of {eu-,}readelf -lS
> on vdso64.so.dbg, and also on the vdso64.so successfully built when you
> revert the patch?

I've attached the raw output from the two commands.  The delta between 
the two is as follows:


-There are 14 section headers, starting at offset 0xd58:
+There are 16 section headers, starting at offset 0xd68:

  Section Headers:
    [Nr] Name              Type             Address           Offset
@@ -33,7 +33,11 @@
    [12] .rela.dyn         RELA             0000000000100be8  00000be8
         0000000000000000  0000000000000018   A       2     0     8
    [13] .shstrtab         STRTAB           0000000000000000  00000cd8
-       0000000000000079  0000000000000000           0     0     1
+       0000000000000089  0000000000000000           0     0     1
+  [14] .symtab           SYMTAB           0000000000000000  00001168
+       0000000000000d80  0000000000000018          15   134     8
+  [15] .strtab           STRTAB           0000000000000000  00001ee8
+       00000000000004a3  0000000000000000           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)


Also, I'm going to be away on holidays next week, so I won't be able to 
test this further until the 19th or so.


Chris

[-- Attachment #2: good.txt --]
[-- Type: text/plain, Size: 3477 bytes --]

good:

[cfriesen@localhost linux-2.6]$ /home/cfriesen/bin/ppc64-R9a/bin/ppc64-R9a-readelf -lS ../g5/arch/powerpc/kernel/vdso64/vdso64.so
There are 14 section headers, starting at offset 0xd58:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .hash             HASH             0000000000100120  00000120
       000000000000004c  0000000000000004   A       2     0     8
  [ 2] .dynsym           DYNSYM           0000000000100170  00000170
       0000000000000150  0000000000000018   A       3     4     8
  [ 3] .dynstr           STRTAB           00000000001002c0  000002c0
       00000000000000ef  0000000000000000   A       0     0     1
  [ 4] .gnu.version      VERSYM           00000000001003b0  000003b0
       000000000000001c  0000000000000002   A       2     0     2
  [ 5] .gnu.version_d    VERDEF           00000000001003d0  000003d0
       0000000000000038  0000000000000000   A       3     2     8
  [ 6] .note             NOTE             0000000000100408  00000408
       0000000000000018  0000000000000000   A       0     0     4
  [ 7] .text             PROGBITS         0000000000100420  00000420
       00000000000002ec  0000000000000000  AX       0     0     8
  [ 8] .eh_frame_hdr     PROGBITS         0000000000100710  00000710
       0000000000000008  0000000000000000   A       0     0     4
  [ 9] .eh_frame         PROGBITS         0000000000100718  00000718
       00000000000004c4  0000000000000000   A       0     0     8
  [10] .got              PROGBITS         0000000000100be0  00000be0
       0000000000000008  0000000000000008  WA       0     0     8
  [11] .dynamic          DYNAMIC          0000000000100be8  00000be8
       00000000000000f0  0000000000000010  WA       3     0     8
  [12] .rela.dyn         RELA             0000000000100be8  00000be8
       0000000000000000  0000000000000018   A       2     0     8
  [13] .shstrtab         STRTAB           0000000000000000  00000cd8
       0000000000000079  0000000000000000           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 0x0
There are 4 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000100000 0x0000000000100000
                 0x0000000000000cd8 0x0000000000000cd8  R E    10000
  NOTE           0x0000000000000408 0x0000000000100408 0x0000000000100408
                 0x0000000000000018 0x0000000000000018  R      4
  DYNAMIC        0x0000000000000be8 0x0000000000100be8 0x0000000000100be8
                 0x00000000000000f0 0x00000000000000f0  R      8
  GNU_EH_FRAME   0x0000000000000710 0x0000000000100710 0x0000000000100710
                 0x0000000000000008 0x0000000000000008  R      4

 Section to Segment mapping:
  Segment Sections...
   00     .hash .dynsym .dynstr .gnu.version .gnu.version_d .note .text .eh_frame_hdr .eh_frame .got .dynamic
   01     .note
   02     .dynamic
   03     .eh_frame_hdr

[-- Attachment #3: bad.txt --]
[-- Type: text/plain, Size: 3750 bytes --]

bad:

[cfriesen@localhost linux-2.6]$ /home/cfriesen/bin/ppc64-R9a/bin/ppc64-R9a-readelf -lS ../g5/arch/powerpc/kernel/vdso64/vdso64.so.dbg
There are 16 section headers, starting at offset 0xd68:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .hash             HASH             0000000000100120  00000120
       000000000000004c  0000000000000004   A       2     0     8
  [ 2] .dynsym           DYNSYM           0000000000100170  00000170
       0000000000000150  0000000000000018   A       3     4     8
  [ 3] .dynstr           STRTAB           00000000001002c0  000002c0
       00000000000000ef  0000000000000000   A       0     0     1
  [ 4] .gnu.version      VERSYM           00000000001003b0  000003b0
       000000000000001c  0000000000000002   A       2     0     2
  [ 5] .gnu.version_d    VERDEF           00000000001003d0  000003d0
       0000000000000038  0000000000000000   A       3     2     8
  [ 6] .note             NOTE             0000000000100408  00000408
       0000000000000018  0000000000000000   A       0     0     4
  [ 7] .text             PROGBITS         0000000000100420  00000420
       00000000000002ec  0000000000000000  AX       0     0     8
  [ 8] .eh_frame_hdr     PROGBITS         0000000000100710  00000710
       0000000000000008  0000000000000000   A       0     0     4
  [ 9] .eh_frame         PROGBITS         0000000000100718  00000718
       00000000000004c4  0000000000000000   A       0     0     8
  [10] .got              PROGBITS         0000000000100be0  00000be0
       0000000000000008  0000000000000008  WA       0     0     8
  [11] .dynamic          DYNAMIC          0000000000100be8  00000be8
       00000000000000f0  0000000000000010  WA       3     0     8
  [12] .rela.dyn         RELA             0000000000100be8  00000be8
       0000000000000000  0000000000000018   A       2     0     8
  [13] .shstrtab         STRTAB           0000000000000000  00000cd8
       0000000000000089  0000000000000000           0     0     1
  [14] .symtab           SYMTAB           0000000000000000  00001168
       0000000000000d80  0000000000000018          15   134     8
  [15] .strtab           STRTAB           0000000000000000  00001ee8
       00000000000004a3  0000000000000000           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 0x0
There are 4 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000100000 0x0000000000100000
                 0x0000000000000cd8 0x0000000000000cd8  R E    10000
  NOTE           0x0000000000000408 0x0000000000100408 0x0000000000100408
                 0x0000000000000018 0x0000000000000018  R      4
  DYNAMIC        0x0000000000000be8 0x0000000000100be8 0x0000000000100be8
                 0x00000000000000f0 0x00000000000000f0  R      8
  GNU_EH_FRAME   0x0000000000000710 0x0000000000100710 0x0000000000100710
                 0x0000000000000008 0x0000000000000008  R      4

 Section to Segment mapping:
  Segment Sections...
   00     .hash .dynsym .dynstr .gnu.version .gnu.version_d .note .text .eh_frame_hdr .eh_frame .got .dynamic
   01     .note
   02     .dynamic
   03     .eh_frame_hdr

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: patch to install unstripped vDSO on disk breaks powerpc kernel build
  2008-05-10  4:43   ` Chris Friesen
@ 2008-05-11  0:40     ` Roland McGrath
  2008-05-21 22:12       ` Chris Friesen
  0 siblings, 1 reply; 5+ messages in thread
From: Roland McGrath @ 2008-05-11  0:40 UTC (permalink / raw)
  To: Chris Friesen; +Cc: linuxppc-dev, paulus

Ok.  That looks like a bug in the older binutils (objcopy) you are using.
It is confused by the empty .rela.dyn section right next to the .dynamic
section.  Current binutils don't seem to have a problem with this.

I haven't tried to get an old binutils running to reproduce this.
I suspect the following change will work around the problem.
It should not cause any problem with newer or older binutils.


Thanks,
Roland

---
[PATCH] powerpc vdso64 linker script tweak

This should work around bugs in older binutils' objcopy.
The placement of these sections does not really matter,
but it confused the buggy old BFD libraries.

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 arch/powerpc/kernel/vdso64/vdso64.lds.S |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/vdso64/vdso64.lds.S b/arch/powerpc/kernel/vdso64/vdso64.lds.S
index 932b3fd..7d6585f 100644
--- a/arch/powerpc/kernel/vdso64/vdso64.lds.S
+++ b/arch/powerpc/kernel/vdso64/vdso64.lds.S
@@ -43,15 +43,15 @@ SECTIONS
 	.rodata		: { *(.rodata .rodata.* .gnu.linkonce.r.*) }
 	.rodata1	: { *(.rodata1) }
 
+	.dynamic	: { *(.dynamic) }		:text	:dynamic
+
 	.eh_frame_hdr	: { *(.eh_frame_hdr) }		:text	:eh_frame_hdr
 	.eh_frame	: { KEEP (*(.eh_frame)) }	:text
 	.gcc_except_table : { *(.gcc_except_table) }
+	.rela.dyn ALIGN(8) : { *(.rela.dyn) }
 
 	.opd ALIGN(8)	: { KEEP (*(.opd)) }
 	.got ALIGN(8)	: { *(.got .toc) }
-	.rela.dyn ALIGN(8) : { *(.rela.dyn) }
-
-	.dynamic	: { *(.dynamic) }		:text	:dynamic
 
 	_end = .;
 	PROVIDE(end = .);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: patch to install unstripped vDSO on disk breaks powerpc kernel build
  2008-05-11  0:40     ` Roland McGrath
@ 2008-05-21 22:12       ` Chris Friesen
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Friesen @ 2008-05-21 22:12 UTC (permalink / raw)
  To: Roland McGrath; +Cc: linuxppc-dev, paulus

Roland McGrath wrote:
> Ok.  That looks like a bug in the older binutils (objcopy) you are using.
> It is confused by the empty .rela.dyn section right next to the .dynamic
> section.  Current binutils don't seem to have a problem with this.
> 
> I haven't tried to get an old binutils running to reproduce this.
> I suspect the following change will work around the problem.
> It should not cause any problem with newer or older binutils.

Thanks, this seems to have fixed the problem.

Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-05-21 22:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-09 17:16 patch to install unstripped vDSO on disk breaks powerpc kernel build Chris Friesen
2008-05-09 19:44 ` Roland McGrath
2008-05-10  4:43   ` Chris Friesen
2008-05-11  0:40     ` Roland McGrath
2008-05-21 22:12       ` Chris Friesen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.