Bug 14105 - .plt has no associated .eh_frame/.debug_frame
Summary: .plt has no associated .eh_frame/.debug_frame
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.24
: P2 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on: 12570
Blocks: 12571
  Show dependency treegraph
 
Reported: 2012-05-13 18:11 UTC by H.J. Lu
Modified: 2012-06-21 19:18 UTC (History)
2 users (show)

See Also:
Host:
Target: x86_64-unknown-linux-gnu
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2012-05-13 18:11:24 UTC
+++ This bug was initially created as a clone of Bug #12570 +++

[hjl@gnu-6 pr12570]$ cat x.c
void foo (void);

void
bar ()
{
  foo ();
}
[hjl@gnu-6 pr12570]$ cat dummy.S 
[hjl@gnu-6 pr12570]$ make
gcc -O2 -fpic   -c -o x.o x.c
./ld -shared -o x.so x.o
gcc -c -O2 -fpic -o dummy.o dummy.S
./ld -shared -o y.so dummy.o x.o
readelf -wf x.so
Contents of the .eh_frame section:

00000000 00000014 00000000 CIE
  Version:               1
  Augmentation:          "zR"
  Code alignment factor: 1
  Data alignment factor: -8
  Return address column: 16
  Augmentation data:     1b

  DW_CFA_def_cfa: r7 (rsp) ofs 8
  DW_CFA_offset: r16 (rip) at cfa-8
  DW_CFA_nop
  DW_CFA_nop

00000018 00000014 0000001c FDE cie=00000000 pc=00000260..00000265
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

readelf -wf y.so
Contents of the .eh_frame section:

00000000 00000014 00000000 CIE
  Version:               1
  Augmentation:          "zR"
  Code alignment factor: 1
  Data alignment factor: -8
  Return address column: 16
  Augmentation data:     1b

  DW_CFA_def_cfa: r7 (rsp) ofs 8
  DW_CFA_offset: r16 (rip) at cfa-8
  DW_CFA_nop
  DW_CFA_nop

00000018 00000024 0000001c FDE cie=00000000 pc=00000240..00000260
  DW_CFA_def_cfa_offset: 16
  DW_CFA_advance_loc: 6 to 00000246
  DW_CFA_def_cfa_offset: 24
  DW_CFA_advance_loc: 10 to 00000250
  DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 8; DW_OP_breg16 (rip): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit11; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus)
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

00000040 00000014 00000044 FDE cie=00000000 pc=00000260..00000265
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

[hjl@gnu-6 pr12570]$ 

Linker doesn't always generate unwind info for PLT.
Comment 1 H.J. Lu 2012-05-13 18:12:10 UTC
Gold doesn't have this problem.
Comment 2 Sourceware Commits 2012-05-22 14:05:30 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	hjl@sourceware.org	2012-05-22 14:05:22

Modified files:
	bfd            : ChangeLog elf32-i386.c elf64-x86-64.c 
	ld/testsuite   : ChangeLog 
	ld/testsuite/ld-elf: eh4.d 
	ld/testsuite/ld-i386: i386.exp 
	ld/testsuite/ld-x86-64: x86-64.exp 
Added files:
	ld/testsuite/ld-i386: pr12570a.d pr12570a.s pr12570b.d 
	                      pr12570b.s 
	ld/testsuite/ld-x86-64: pr12570a.d pr12570a.s pr12570b.d 
	                        pr12570b.s 

Log message:
	Always create PLT eh_frame section for i386/x86-64
	
	bfd/
	
	2012-05-22  H.J. Lu  <hongjiu.lu@intel.com>
	
	PR ld/14105
	* elf32-i386.c (elf_i386_create_dynamic_sections): Always
	create PLT eh_frame section with SEC_LINKER_CREATED.
	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Likewise.
	
	ld/testsuite/
	
	2012-05-20  H.J. Lu  <hongjiu.lu@intel.com>
	
	PR ld/14105
	* ld-elf/eh4.d: Add PLT eh_frame.
	
	* ld-i386/i386.exp: Run pr12570a and pr12570b.
	* ld-x86-64/x86-64.exp: Likewise.
	
	* ld-i386/pr12570a.d: New file.
	* ld-i386/pr12570a.s: Likewise.
	* ld-i386/pr12570b.s: Likewise.
	* ld-i386/pr12570b.s: Likewise.
	* ld-x86-64/pr12570a.d: Likewise.
	* ld-x86-64/pr12570a.s: Likewise.
	* ld-x86-64/pr12570b.d: Likewise.
	* ld-x86-64/pr12570b.s: Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5705&r2=1.5706
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-i386.c.diff?cvsroot=src&r1=1.273&r2=1.274
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-x86-64.c.diff?cvsroot=src&r1=1.263&r2=1.264
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1542&r2=1.1543
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/eh4.d.diff?cvsroot=src&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-i386/pr12570a.d.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-i386/pr12570a.s.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-i386/pr12570b.d.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-i386/pr12570b.s.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-i386/i386.exp.diff?cvsroot=src&r1=1.43&r2=1.44
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-x86-64/pr12570a.d.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-x86-64/pr12570a.s.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-x86-64/pr12570b.d.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-x86-64/pr12570b.s.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-x86-64/x86-64.exp.diff?cvsroot=src&r1=1.43&r2=1.44
Comment 3 H.J. Lu 2012-06-21 19:18:36 UTC
Fixed.