* RFC: Unwind info for PLT
@ 2011-06-10 7:45 Jakub Jelinek
2011-06-10 14:11 ` Mark Kettenis
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Jakub Jelinek @ 2011-06-10 7:45 UTC (permalink / raw)
To: libc-alpha, binutils, gdb; +Cc: Mark Wielaard, Frank Eigler
Hi!
Sorry for the wide posting, but this is something that isn't limited
to one particular component.
Frank yesterday raised on IRC a problem that PLT doesn't have unwind info.
So, when a debugger or systemtap stops in PLT or if an async signal
is sent to the process while inside of PLT and e.g. calls backtrace or
attempts to unwind through, it will stop in the PLT slot.
Example testcase:
cat > lib1.c <<\EOF
#define A(n) void n (void) {}
#define B(n) A(n##0) A(n##1) A(n##2) A(n##3) A(n##4) A(n##5) A(n##6) A(n##7) A(n##8) A(n##9)
#define C(n) B(n##0) B(n##1) B(n##2) B(n##3) B(n##4) B(n##5) B(n##6) B(n##7) B(n##8) B(n##9)
#define D(n) C(n##0) C(n##1) C(n##2) C(n##3) C(n##4) C(n##5) C(n##6) C(n##7) C(n##8) C(n##9)
#define E(n) D(n##0) D(n##1) D(n##2) D(n##3) D(n##4) D(n##5) D(n##6) D(n##7) D(n##8) D(n##9)
E(f)
EOF
cat > prg1.c <<\EOF
#include <stddef.h>
#include <execinfo.h>
#include <signal.h>
#define A(n) extern void n (void);
#define B(n) A(n##0) A(n##1) A(n##2) A(n##3) A(n##4) A(n##5) A(n##6) A(n##7) A(n##8) A(n##9)
#define C(n) B(n##0) B(n##1) B(n##2) B(n##3) B(n##4) B(n##5) B(n##6) B(n##7) B(n##8) B(n##9)
#define D(n) C(n##0) C(n##1) C(n##2) C(n##3) C(n##4) C(n##5) C(n##6) C(n##7) C(n##8) C(n##9)
#define E(n) D(n##0) D(n##1) D(n##2) D(n##3) D(n##4) D(n##5) D(n##6) D(n##7) D(n##8) D(n##9)
E(f)
static void
handler (int sig, siginfo_t *info, void *ctx)
{
void *buf[256];
int n = backtrace (buf, 256);
backtrace_symbols_fd (buf, n, 2);
}
int
main ()
{
struct sigaction s;
sigemptyset (&s.sa_mask);
s.sa_sigaction = handler;
s.sa_flags = SA_RESETHAND | SA_ONSTACK;
sigaction (SIGUSR1, &s, NULL);
#undef A
#define A(n) n ();
E(f)
return 0;
}
EOF
gcc -shared -fpic -O2 -o lib1.so lib1.c -g
gcc -O2 -g -o prg1 prg1.c ./lib1.so
gdb apparently has some code to default to a certain unwind info if no FDE is found,
as b 'f0001@plt'; c; bt; works and stepi; bt; works too, but next stepi; bt; already gives
#0 0x0000000000494f73 in f0001@plt ()
#1 0x0000000000000be7 in ?? ()
#2 0x00000000004b03d8 in main () at prg1.c:29
instead of
#0 0x0000000000494f73 in f0001@plt ()
#1 0x00000000004b03d8 in main () at prg1.c:29
But when doing b 'f0002@plt'; c; then kill -USR1 `pidof prg1` from another terminal
and then continuing, the backtrace shown stops in the plt and doesn't go back.
I wonder whether ld couldn't synthetize unwind info for the .plt section
(perhaps with some option), or alternatively if it couldn't just provide
hidden __PLT_START__/__PLT_END__ or similar symbols and the unwind info couldn't
be written in glibc crtfiles linked into it.
For x86_64 which has .plt like:
Disassembly of section .plt:
00000035e7a1ec50 <calloc@plt-0x10>:
35e7a1ec50: ff 35 9a 33 37 00 pushq 0x37339a(%rip) # 35e7d91ff0 <_GLOBAL_OFFSET_TABLE_+0x8>
35e7a1ec56: ff 25 9c 33 37 00 jmpq *0x37339c(%rip) # 35e7d91ff8 <_GLOBAL_OFFSET_TABLE_+0x10>
35e7a1ec5c: 0f 1f 40 00 nopl 0x0(%rax)
00000035e7a1ec60 <calloc@plt>:
35e7a1ec60: ff 25 9a 33 37 00 jmpq *0x37339a(%rip) # 35e7d92000 <_GLOBAL_OFFSET_TABLE_+0x18>
35e7a1ec66: 68 00 00 00 00 pushq $0x0
35e7a1ec6b: e9 e0 ff ff ff jmpq 35e7a1ec50 <data.9331+0x35e7a1ebc8>
00000035e7a1ec70 <realloc@plt>:
35e7a1ec70: ff 25 92 33 37 00 jmpq *0x373392(%rip) # 35e7d92008 <_GLOBAL_OFFSET_TABLE_+0x20>
35e7a1ec76: 68 01 00 00 00 pushq $0x1
35e7a1ec7b: e9 d0 ff ff ff jmpq 35e7a1ec50 <data.9331+0x35e7a1ebc8>
...
I think unwind info could look roughly like untested following
if we raised .plt alignment to 16 bytes instead of 4,
i.e. have explicit unwind info for the first 16 bytes
and then for the rest compute CFA expression as
%rsp + 8 + ((%rip & 15) >= 11) * 8
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=__PLT_START__..__PLT_END__
DW_CFA_def_cfa_offset: 16
DW_CFA_advance_loc: 6 to __PLT_START__+6
DW_CFA_def_cfa_offset: 24
DW_CFA_advance_loc: 10 to __PLT_START__+16
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_OP_nop
DW_OP_nop
DW_OP_nop
DW_OP_nop
If .plt is kept just 4 bytes aligned it would be slightly harder.
If we could rely on %rip being just xxx@plt, xxx@plt+6 or xxx@plt+11,
we could just dereference the byte at %rip and decide based on it,
somathing like
%rsp + 8 + (*(char*)%rip == 0xe9) * 8
DW_CFA_def_cfa_expression: (DW_OP_breg7 (rsp): 8 DW_OP_breg16 (rip): 0; DW_OP_deref_size: 1; DW_OP_const1u: 233; DW_OP_eq; DW_OP_lit3; DW_OP_shl; DW_OP_plus;)
but can we rely on it (i.e. won't something give us %rip-1 instead)?
I think for at least the libgcc unwinder it shouldn't, because the
only way to see a PLT slot is through an async signal handler that stops
inside of PLT and the sigreturn pad should be using S.
Anyway, I think hardcoding this in the linker would be problematic,
we couldn't tweak it, so providing some special hidden symbols around
the .plt section and let glibc crtfiles provide it sounds like the best
option to me.
What do you think? For other architectures of course the unwind info would
need to be different, i?86 32-bit would look quite similar if we use the
insn decoding version, as there the only jump after one push (disregarding
first 16 bytes of .plt section which would be explicit) has also 0xe9 opcode,
just the register numbers would be different, offset 4 instead of 8 and
shl by 2 instead of 3.
BTW, the unwind info for _dl_runtime_resolve on x86_64 is wrong on
the first instruction as well:
(gdb) bt
#0 0x00000035e7613840 in _dl_runtime_resolve () from /lib64/ld-linux-x86-64.so.2
#1 0x00000035e78202a8 in _r_debug ()
#2 0x0000000000000be7 in ?? ()
#3 0x00000000004b03d8 in main () at prg1.c:29
(gdb) stepi
0x00000035e7613844 in _dl_runtime_resolve () from /lib64/ld-linux-x86-64.so.2
(gdb) bt
#0 0x00000035e7613844 in _dl_runtime_resolve () from /lib64/ld-linux-x86-64.so.2
#1 0x00000000004b03d8 in main () at prg1.c:29
Untested fix below:
2011-06-10 Jakub Jelinek <jakub@redhat.com>
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve): Fix CFA
offset on the first insn.
--- libc/sysdeps/x86_64/dl-trampoline.S.jj 2009-08-29 03:34:52.000000000 +0200
+++ libc/sysdeps/x86_64/dl-trampoline.S 2011-06-10 09:34:16.000000000 +0200
@@ -1,5 +1,5 @@
/* PLT trampolines. x86-64 version.
- Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,8 +27,9 @@
.align 16
cfi_startproc
_dl_runtime_resolve:
+ cfi_adjust_cfa_offset(16) # Incorporate PLT
subq $56,%rsp
- cfi_adjust_cfa_offset(72) # Incorporate PLT
+ cfi_adjust_cfa_offset(56)
movq %rax,(%rsp) # Preserve registers otherwise clobbered.
movq %rcx, 8(%rsp)
movq %rdx, 16(%rsp)
Jakub
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: RFC: Unwind info for PLT
2011-06-10 7:45 RFC: Unwind info for PLT Jakub Jelinek
@ 2011-06-10 14:11 ` Mark Kettenis
2011-06-10 14:17 ` Joseph S. Myers
2011-06-10 15:15 ` Richard Henderson
2 siblings, 0 replies; 12+ messages in thread
From: Mark Kettenis @ 2011-06-10 14:11 UTC (permalink / raw)
To: jakub; +Cc: libc-alpha, binutils, gdb, mjw, fche
> Date: Fri, 10 Jun 2011 09:45:24 +0200
> From: Jakub Jelinek <jakub@redhat.com>
>
> Hi!
>
> gdb apparently has some code to default to a certain unwind info if
> no FDE is found, as b 'f0001@plt'; c; bt; works and stepi; bt; works
> too, but next stepi; bt; already gives
> #0 0x0000000000494f73 in f0001@plt ()
> #1 0x0000000000000be7 in ?? ()
> #2 0x00000000004b03d8 in main () at prg1.c:29
> instead of
> #0 0x0000000000494f73 in f0001@plt ()
> #1 0x00000000004b03d8 in main () at prg1.c:29
> But when doing b 'f0002@plt'; c; then kill -USR1 `pidof prg1` from
> another terminal and then continuing, the backtrace shown stops in
> the plt and doesn't go back.
Typically PLT entries are handled by unwinders that analyze the code,
either by the default unwinder that does standard prologue analysis
(sparc/sparc64) or a dedicated unwinder (s390 for example). For most
targets this isn't a big issue, since the PLT stubs are typically
defined by the appropriate ABI. Generally the most difficult part is
to figure out where the PLT entries actually start since linkers are a
bit inconsistent in choosing symbol names for the start of the PLT,
and not all targets have a proper .plt section.
Looks like we don't do a particular good job on amd64 though. Seems
nobody actually bothered to do this properly for i386/amd64, probably
because it mostly works without special code.
> I wonder whether ld couldn't synthetize unwind info for the .plt
> section (perhaps with some option),
A potential problem here is that the PLT entries get patched up by the
dynamic linker. You must make sure that the unwind info is correct
for both the unpacthed and patched versions of the PLT entries. That
may not be possible. But otherwise I think this is a sound idea.
> or alternatively if it couldn't just provide hidden
> __PLT_START__/__PLT_END__ or similar symbols and the unwind info
> couldn't be written in glibc crtfiles linked into it.
I don't think I fully understand what you're trying to say here.
Sounds complicated/fragile. The canonical name for the start of the
PLT is _PROCEDURE_LINKAGE_TABLE_, but as I said the PLT isn't
consistently named across toolchains. I think for GNU ld, the name is
assigned by a linker script, which people tend to replace by something
they've written themselves.
> 00000035e7a1ec60 <calloc@plt>:
> 35e7a1ec60: ff 25 9a 33 37 00 jmpq *0x37339a(%rip) # 35e7d92000 <_GLOBAL_OFFSET_TABLE_+0x18>
> 35e7a1ec66: 68 00 00 00 00 pushq $0x0
> 35e7a1ec6b: e9 e0 ff ff ff jmpq 35e7a1ec50 <data.9331+0x35e7a1ebc8>
That pushq instruction is the reason you get that weird backtrace.
> Anyway, I think hardcoding this in the linker would be problematic,
> we couldn't tweak it, so providing some special hidden symbols around
> the .plt section and let glibc crtfiles provide it sounds like the best
> option to me.
Well, the linker is the one generating/inserting the PLT entries. So
it should know how to generate unwind infor for them. I really don't
see how you could make sure that the description provided the crtfiles
are consistent with what the linker generated.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: RFC: Unwind info for PLT
2011-06-10 7:45 RFC: Unwind info for PLT Jakub Jelinek
2011-06-10 14:11 ` Mark Kettenis
@ 2011-06-10 14:17 ` Joseph S. Myers
2011-06-10 15:15 ` Richard Henderson
2 siblings, 0 replies; 12+ messages in thread
From: Joseph S. Myers @ 2011-06-10 14:17 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: libc-alpha, binutils, gdb, Mark Wielaard, Frank Eigler
On Fri, 10 Jun 2011, Jakub Jelinek wrote:
> Anyway, I think hardcoding this in the linker would be problematic,
> we couldn't tweak it, so providing some special hidden symbols around
> the .plt section and let glibc crtfiles provide it sounds like the best
> option to me.
I think that when the linker generates code it should generate unwind info
for it to allow accurate backtraces from any instruction (both .eh_frame
and .debug_frame, or target-specific forms on some targets). The details
of this generated code may not be part of the ABI on all targets, may vary
depending on the linker version and may be a lot more complicated than a
single PLT section - there are lots of purposes for which the linker may
generate code. I don't think glibc crtfiles are a good place for it.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: RFC: Unwind info for PLT
2011-06-10 7:45 RFC: Unwind info for PLT Jakub Jelinek
2011-06-10 14:11 ` Mark Kettenis
2011-06-10 14:17 ` Joseph S. Myers
@ 2011-06-10 15:15 ` Richard Henderson
2011-06-13 17:14 ` Jakub Jelinek
2 siblings, 1 reply; 12+ messages in thread
From: Richard Henderson @ 2011-06-10 15:15 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: libc-alpha, binutils, gdb, Mark Wielaard, Frank Eigler
On 06/10/2011 12:45 AM, Jakub Jelinek wrote:
> Anyway, I think hardcoding this in the linker would be problematic,
> we couldn't tweak it, so providing some special hidden symbols around
> the .plt section and let glibc crtfiles provide it sounds like the best
> option to me.
Would it be problematic beyond the fact that it's easier to write the
directives in assembler than it is within bfd?
We couldn't tweak it, sure, but don't we need to tweak the linker
anyway if the PLT gets changed? It seems more logical to me to emit
this within the linker itself.
As for the actual unwind info, I agree that using pointer arithmetic
is the better expression over decoding the insns. Increasing the
alignment is probably a good idea, also for the actual decoding of
the insns on the real hardware.
r~
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: RFC: Unwind info for PLT
2011-06-10 15:15 ` Richard Henderson
@ 2011-06-13 17:14 ` Jakub Jelinek
2011-06-13 17:34 ` Richard Henderson
0 siblings, 1 reply; 12+ messages in thread
From: Jakub Jelinek @ 2011-06-13 17:14 UTC (permalink / raw)
To: Richard Henderson; +Cc: libc-alpha, binutils, gdb, Mark Wielaard, Frank Eigler
On Fri, Jun 10, 2011 at 08:15:37AM -0700, Richard Henderson wrote:
> On 06/10/2011 12:45 AM, Jakub Jelinek wrote:
> > Anyway, I think hardcoding this in the linker would be problematic,
> > we couldn't tweak it, so providing some special hidden symbols around
> > the .plt section and let glibc crtfiles provide it sounds like the best
> > option to me.
>
> Would it be problematic beyond the fact that it's easier to write the
> directives in assembler than it is within bfd?
Yeah, easier to write and easier to change. Anyway, if you prefer to do
it in ld, I can try to do it there. Just a question, should it be done
unconditionally, or guarded with some ld cmdline option (either existing one, like
abuse --eh-frame-hdr for it, or a new one)?
On other targets like SPARC or PowerPC -mbss-plt it is the dynamic linker
which updates or completely writes .plt section though, should in that
case the dynamic linker provide the unwind info instead?
> As for the actual unwind info, I agree that using pointer arithmetic
> is the better expression over decoding the insns. Increasing the
> alignment is probably a good idea, also for the actual decoding of
> the insns on the real hardware.
Ok.
Jakub
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: RFC: Unwind info for PLT
2011-06-13 17:14 ` Jakub Jelinek
@ 2011-06-13 17:34 ` Richard Henderson
2011-06-13 20:53 ` Ian Lance Taylor
0 siblings, 1 reply; 12+ messages in thread
From: Richard Henderson @ 2011-06-13 17:34 UTC (permalink / raw)
To: Jakub Jelinek
Cc: Richard Henderson, libc-alpha, binutils, gdb, Mark Wielaard,
Frank Eigler
On 06/13/2011 10:13 AM, Jakub Jelinek wrote:
> Yeah, easier to write and easier to change. Anyway, if you prefer to do
> it in ld, I can try to do it there. Just a question, should it be done
> unconditionally, or guarded with some ld cmdline option (either existing one, like
> abuse --eh-frame-hdr for it, or a new one)?
I don't have a real preference. I could see abusing --eh-frame-hdr makes sense.
> On other targets like SPARC or PowerPC -mbss-plt it is the dynamic linker
> which updates or completely writes .plt section though, should in that
> case the dynamic linker provide the unwind info instead?
I thought that those ABIs were deprecated. At which point I don't find
myself caring much. Besides -- the RISC PLT formats don't adjust the
stack, so the "default" unwinding rule of looking at the return address
works.
r~
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: RFC: Unwind info for PLT
2011-06-13 17:34 ` Richard Henderson
@ 2011-06-13 20:53 ` Ian Lance Taylor
2011-06-14 20:19 ` Jakub Jelinek
0 siblings, 1 reply; 12+ messages in thread
From: Ian Lance Taylor @ 2011-06-13 20:53 UTC (permalink / raw)
To: Richard Henderson
Cc: Jakub Jelinek, Richard Henderson, libc-alpha, binutils, gdb,
Mark Wielaard, Frank Eigler
Richard Henderson <rth@redhat.com> writes:
> On 06/13/2011 10:13 AM, Jakub Jelinek wrote:
>> Yeah, easier to write and easier to change. Anyway, if you prefer to do
>> it in ld, I can try to do it there. Just a question, should it be done
>> unconditionally, or guarded with some ld cmdline option (either existing one, like
>> abuse --eh-frame-hdr for it, or a new one)?
>
> I don't have a real preference. I could see abusing --eh-frame-hdr makes sense.
I believe the default should be to generate the additional new unwind
information. The only people who would not want it would be people who
want to minimize their binary size. I also don't think this has
anything to do with --eh-frame-hdr, which simply directs the linker to
create a PT_GNU_EH_FRAME program header. So I think there should be a
new linker option to *not* generate unwind info, and we should have
-fno-unwind-tables pass that option to a linker which understands it.
Ian
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: RFC: Unwind info for PLT
2011-06-13 20:53 ` Ian Lance Taylor
@ 2011-06-14 20:19 ` Jakub Jelinek
2011-06-20 9:32 ` [PATCH] Unwind info for PLT on i?86/x86_64 Jakub Jelinek
0 siblings, 1 reply; 12+ messages in thread
From: Jakub Jelinek @ 2011-06-14 20:19 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: Richard Henderson, binutils, Mark Wielaard, Frank Eigler
On Mon, Jun 13, 2011 at 01:53:38PM -0700, Ian Lance Taylor wrote:
> Richard Henderson <rth@redhat.com> writes:
>
> > On 06/13/2011 10:13 AM, Jakub Jelinek wrote:
> >> Yeah, easier to write and easier to change. Anyway, if you prefer to do
> >> it in ld, I can try to do it there. Just a question, should it be done
> >> unconditionally, or guarded with some ld cmdline option (either existing one, like
> >> abuse --eh-frame-hdr for it, or a new one)?
> >
> > I don't have a real preference. I could see abusing --eh-frame-hdr makes sense.
>
> I believe the default should be to generate the additional new unwind
> information. The only people who would not want it would be people who
> want to minimize their binary size. I also don't think this has
> anything to do with --eh-frame-hdr, which simply directs the linker to
> create a PT_GNU_EH_FRAME program header. So I think there should be a
> new linker option to *not* generate unwind info, and we should have
> -fno-unwind-tables pass that option to a linker which understands it.
Ok, here is a WIP patch which seems to work in light testing on x86_64.
It doesn't have yet an option to force no generation of the unwind info,
and some testcases (especially for TLS transitions) will either need
to be adjusted or get passed the new option to prevent .eh_frame for
.plt, as the 16 byte instead of 4 byte alignment of .plt section
shifted various offsets in those.
2011-06-14 Jakub Jelinek <jakub@redhat.com>
* elf-eh-frame.c (_bfd_elf_parse_eh_frame): Allow no relocations
at all for linker created .eh_frame sections.
(_bfd_elf_discard_section_eh_frame): Handle linker created
.eh_frame sections with no relocations.
* elf64-x86-64.c: Include dwarf2.h.
(elf_x86_64_eh_frame_plt): New variable.
(PLT_CIE_LENGTH, PLT_FDE_LENGTH, PLT_FDE_START_OFFSET,
PLT_FDE_LEN_OFFSET): Define.
(struct elf_x86_64_link_hash_table): Add plt_eh_frame field.
(elf_x86_64_create_dynamic_sections): Create and fill in
.eh_frame section for .plt section.
(elf_x86_64_size_dynamic_sections): Write .plt section size
into .eh_frame FDE covering .plt section.
(elf_x86_64_finish_dynamic_sections): Write .plt section
start into .eh_frame FDE covering .plt section. Call
_bfd_elf_write_section_eh_frame on htab->plt_eh_frame section.
(elf_backend_plt_alignment): Define to 4.
--- bfd/elf-eh-frame.c.jj 2011-03-16 10:27:06.000000000 +0100
+++ bfd/elf-eh-frame.c 2011-06-14 20:33:15.000000000 +0200
@@ -777,8 +777,6 @@ _bfd_elf_parse_eh_frame (bfd *abfd, stru
}
else
{
- asection *rsec;
-
/* Find the corresponding CIE. */
unsigned int cie_offset = this_inf->offset + 4 - hdr_id;
for (cie = local_cies; cie < local_cies + cie_count; cie++)
@@ -794,17 +792,22 @@ _bfd_elf_parse_eh_frame (bfd *abfd, stru
= cie->cie_inf->add_augmentation_size;
ENSURE_NO_RELOCS (buf);
- REQUIRE (GET_RELOC (buf));
-
- /* Chain together the FDEs for each section. */
- rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie);
- /* RSEC will be NULL if FDE was cleared out as it was belonging to
- a discarded SHT_GROUP. */
- if (rsec)
+ if ((sec->flags & SEC_LINKER_CREATED) == 0 || cookie->rels != NULL)
{
- REQUIRE (rsec->owner == abfd);
- this_inf->u.fde.next_for_section = elf_fde_list (rsec);
- elf_fde_list (rsec) = this_inf;
+ asection *rsec;
+
+ REQUIRE (GET_RELOC (buf));
+
+ /* Chain together the FDEs for each section. */
+ rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie);
+ /* RSEC will be NULL if FDE was cleared out as it was belonging to
+ a discarded SHT_GROUP. */
+ if (rsec)
+ {
+ REQUIRE (rsec->owner == abfd);
+ this_inf->u.fde.next_for_section = elf_fde_list (rsec);
+ elf_fde_list (rsec) = this_inf;
+ }
}
/* Skip the initial location and address range. */
@@ -1137,6 +1140,9 @@ _bfd_elf_discard_section_eh_frame
if (sec_info == NULL)
return FALSE;
+ ptr_size = (get_elf_backend_data (sec->owner)
+ ->elf_backend_eh_frame_address_size (sec->owner, sec));
+
hdr_info = &elf_hash_table (info)->eh_info;
for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent)
if (ent->size == 4)
@@ -1145,11 +1151,25 @@ _bfd_elf_discard_section_eh_frame
ent->removed = sec->map_head.s != NULL;
else if (!ent->cie)
{
- cookie->rel = cookie->rels + ent->reloc_index;
- /* FIXME: octets_per_byte. */
- BFD_ASSERT (cookie->rel < cookie->relend
- && cookie->rel->r_offset == ent->offset + 8);
- if (!(*reloc_symbol_deleted_p) (ent->offset + 8, cookie))
+ bfd_boolean keep;
+ if ((sec->flags & SEC_LINKER_CREATED) != 0 && cookie->rels == NULL)
+ {
+ unsigned int width
+ = get_DW_EH_PE_width (ent->fde_encoding, ptr_size);
+ bfd_vma value
+ = read_value (abfd, sec->contents + ent->offset + 8 + width,
+ width, get_DW_EH_PE_signed (ent->fde_encoding));
+ keep = value != 0;
+ }
+ else
+ {
+ cookie->rel = cookie->rels + ent->reloc_index;
+ /* FIXME: octets_per_byte. */
+ BFD_ASSERT (cookie->rel < cookie->relend
+ && cookie->rel->r_offset == ent->offset + 8);
+ keep = !(*reloc_symbol_deleted_p) (ent->offset + 8, cookie);
+ }
+ if (keep)
{
if (info->shared
&& (((ent->fde_encoding & 0x70) == DW_EH_PE_absptr
@@ -1178,8 +1198,6 @@ _bfd_elf_discard_section_eh_frame
sec_info->cies = NULL;
}
- ptr_size = (get_elf_backend_data (sec->owner)
- ->elf_backend_eh_frame_address_size (sec->owner, sec));
offset = 0;
for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent)
if (!ent->removed)
--- bfd/elf64-x86-64.c.jj 2011-06-14 08:59:45.000000000 +0200
+++ bfd/elf64-x86-64.c 2011-06-14 22:01:44.000000000 +0200
@@ -29,6 +29,7 @@
#include "bfd_stdint.h"
#include "objalloc.h"
#include "hashtab.h"
+#include "dwarf2.h"
#include "elf/x86-64.h"
@@ -408,6 +409,45 @@ static const bfd_byte elf_x86_64_plt_ent
0, 0, 0, 0 /* replaced with offset to start of .plt0. */
};
+/* .eh_frame covering the .plt section. */
+
+static const bfd_byte elf_x86_64_eh_frame_plt[] =
+{
+#define PLT_CIE_LENGTH 20
+#define PLT_FDE_LENGTH 36
+#define PLT_FDE_START_OFFSET 4 + PLT_CIE_LENGTH + 8
+#define PLT_FDE_LEN_OFFSET 4 + PLT_CIE_LENGTH + 12
+ PLT_CIE_LENGTH, 0, 0, 0, /* CIE length */
+ 0, 0, 0, 0, /* CIE ID */
+ 1, /* CIE version */
+ 'z', 'R', 0, /* Augmentation string */
+ 1, /* Code alignment factor */
+ 0x78, /* Data alignment factor */
+ 16, /* Return address column */
+ 1, /* Augmentation size */
+ DW_EH_PE_pcrel | DW_EH_PE_sdata4, /* FDE encoding */
+ DW_CFA_def_cfa, 7, 8, /* DW_CFA_def_cfa: r7 (rsp) ofs 8 */
+ DW_CFA_offset + 16, 1, /* DW_CFA_offset: r16 (rip) at cfa-8 */
+ DW_CFA_nop, DW_CFA_nop,
+
+ PLT_FDE_LENGTH, 0, 0, 0, /* FDE length */
+ PLT_CIE_LENGTH + 8, 0, 0, 0, /* CIE pointer */
+ 0, 0, 0, 0, /* R_X86_64_PC32 .plt goes here */
+ 0, 0, 0, 0, /* .plt size goes here */
+ 0, /* Augmentation size */
+ DW_CFA_def_cfa_offset, 16, /* DW_CFA_def_cfa_offset: 16 */
+ DW_CFA_advance_loc + 6, /* DW_CFA_advance_loc: 6 to __PLT__+6 */
+ DW_CFA_def_cfa_offset, 24, /* DW_CFA_def_cfa_offset: 24 */
+ DW_CFA_advance_loc + 6, /* DW_CFA_advance_loc: 10 to __PLT__+16 */
+ DW_CFA_def_cfa_expression, /* DW_CFA_def_cfa_expression */
+ 11, /* Block length */
+ DW_OP_breg7, 8, /* DW_OP_breg7 (rsp): 8 */
+ DW_OP_breg16, 0, /* 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
+};
+
/* x86-64 ELF linker hash entry. */
struct elf_x86_64_link_hash_entry
@@ -481,6 +521,7 @@ struct elf_x86_64_link_hash_table
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
+ asection *plt_eh_frame;
union
{
@@ -727,6 +768,23 @@ elf_x86_64_create_dynamic_sections (bfd
|| (!info->shared && !htab->srelbss))
abort ();
+ if (bfd_get_section_by_name (dynobj, ".eh_frame") == NULL
+ && htab->elf.splt != NULL)
+ {
+ flagword flags = get_elf_backend_data (dynobj)->dynamic_sec_flags;
+ htab->plt_eh_frame
+ = bfd_make_section_with_flags (dynobj, ".eh_frame",
+ flags | SEC_READONLY);
+ if (htab->plt_eh_frame == NULL
+ || !bfd_set_section_alignment (dynobj, htab->plt_eh_frame, 3))
+ return FALSE;
+
+ htab->plt_eh_frame->size = sizeof (elf_x86_64_eh_frame_plt);
+ htab->plt_eh_frame->contents
+ = bfd_alloc (dynobj, htab->plt_eh_frame->size);
+ memcpy (htab->plt_eh_frame->contents, elf_x86_64_eh_frame_plt,
+ sizeof (elf_x86_64_eh_frame_plt));
+ }
return TRUE;
}
@@ -2601,6 +2659,13 @@ elf_x86_64_size_dynamic_sections (bfd *o
return FALSE;
}
+ if (htab->plt_eh_frame != NULL
+ && htab->elf.splt != NULL
+ && htab->elf.splt->size != 0
+ && (htab->elf.splt->flags & SEC_EXCLUDE) == 0)
+ bfd_put_32 (dynobj, htab->elf.splt->size,
+ htab->plt_eh_frame->contents + PLT_FDE_LEN_OFFSET);
+
if (htab->elf.dynamic_sections_created)
{
/* Add some entries to the .dynamic section. We fill in the
@@ -4401,6 +4466,33 @@ elf_x86_64_finish_dynamic_sections (bfd
GOT_ENTRY_SIZE;
}
+ /* Adjust .eh_frame for .plt section. */
+ if (htab->plt_eh_frame != NULL)
+ {
+ if (htab->elf.splt != NULL
+ && htab->elf.splt->size != 0
+ && (htab->elf.splt->flags & SEC_EXCLUDE) == 0
+ && htab->elf.splt->output_section != NULL
+ && htab->plt_eh_frame->output_section != NULL)
+ {
+ bfd_vma plt_start = htab->elf.splt->output_section->vma;
+ bfd_vma eh_frame_start = htab->plt_eh_frame->output_section->vma
+ + htab->plt_eh_frame->output_offset
+ + PLT_FDE_START_OFFSET;
+ bfd_put_signed_32 (dynobj, plt_start - eh_frame_start,
+ htab->plt_eh_frame->contents
+ + PLT_FDE_START_OFFSET);
+ }
+ if (htab->plt_eh_frame->sec_info_type
+ == ELF_INFO_TYPE_EH_FRAME)
+ {
+ if (! _bfd_elf_write_section_eh_frame (output_bfd, info,
+ htab->plt_eh_frame,
+ htab->plt_eh_frame->contents))
+ return FALSE;
+ }
+ }
+
if (htab->elf.sgot && htab->elf.sgot->size > 0)
elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize
= GOT_ENTRY_SIZE;
@@ -4667,6 +4759,7 @@ static const struct bfd_elf_special_sect
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size (GOT_ENTRY_SIZE*3)
#define elf_backend_rela_normal 1
+#define elf_backend_plt_alignment 4
#define elf_info_to_howto elf_x86_64_info_to_howto
Jakub
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Unwind info for PLT on i?86/x86_64
2011-06-14 20:19 ` Jakub Jelinek
@ 2011-06-20 9:32 ` Jakub Jelinek
2011-06-20 12:21 ` Richard Henderson
2011-06-20 13:03 ` H.J. Lu
0 siblings, 2 replies; 12+ messages in thread
From: Jakub Jelinek @ 2011-06-20 9:32 UTC (permalink / raw)
To: binutils; +Cc: Ian Lance Taylor, Richard Henderson, Mark Wielaard, Frank Eigler
On Tue, Jun 14, 2011 at 10:18:44PM +0200, Jakub Jelinek wrote:
> Ok, here is a WIP patch which seems to work in light testing on x86_64.
> It doesn't have yet an option to force no generation of the unwind info,
> and some testcases (especially for TLS transitions) will either need
> to be adjusted or get passed the new option to prevent .eh_frame for
> .plt, as the 16 byte instead of 4 byte alignment of .plt section
> shifted various offsets in those.
And here is an updated patch, this time for both i?86 and x86-64,
with an option to disable it (but the default being to emit
unwind info for ld generated code sections) and testsuite adjustments.
Ok for trunk?
2011-06-20 Jakub Jelinek <jakub@redhat.com>
include/
* bfdlink.h (struct bfd_link_info): Add no_ld_generated_unwind_info
option.
ld/
* emultempl/elf32.em (OPTION_LD_GENERATED_UNWIND_INFO,
OPTION_NO_LD_GENERATED_UNWIND_INFO): Define.
(gld${EMULATION_NAME}_handle_option): Handle
--ld-generated-unwind-info and --no-ld-generated-unwind-info.
* ld.texinfo (--ld-generated-unwind-info,
--no-ld-generated-unwind-info): Document.
bfd/
* elf-eh-frame.c (_bfd_elf_parse_eh_frame): Allow no relocations
at all for linker created .eh_frame sections.
(_bfd_elf_discard_section_eh_frame): Handle linker created
.eh_frame sections with no relocations.
* elf64-x86-64.c: Include dwarf2.h.
(elf_x86_64_eh_frame_plt): New variable.
(PLT_CIE_LENGTH, PLT_FDE_LENGTH, PLT_FDE_START_OFFSET,
PLT_FDE_LEN_OFFSET): Define.
(struct elf_x86_64_link_hash_table): Add plt_eh_frame field.
(elf_x86_64_create_dynamic_sections): Create and fill in
.eh_frame section for .plt section.
(elf_x86_64_size_dynamic_sections): Write .plt section size
into .eh_frame FDE covering .plt section.
(elf_x86_64_finish_dynamic_sections): Write .plt section
start into .eh_frame FDE covering .plt section. Call
_bfd_elf_write_section_eh_frame on htab->plt_eh_frame section.
(elf_backend_plt_alignment): Define to 4.
* elf32-i386.c: Include dwarf2.h.
(elf_i386_eh_frame_plt): New variable.
(PLT_CIE_LENGTH, PLT_FDE_LENGTH, PLT_FDE_START_OFFSET,
PLT_FDE_LEN_OFFSET): Define.
(struct elf_i386_link_hash_table): Add plt_eh_frame field.
(elf_i386_create_dynamic_sections): Create and fill in
.eh_frame section for .plt section.
(elf_i386_size_dynamic_sections): Write .plt section size
into .eh_frame FDE covering .plt section.
(elf_i386_finish_dynamic_sections): Write .plt section
start into .eh_frame FDE covering .plt section. Call
_bfd_elf_write_section_eh_frame on htab->plt_eh_frame section.
(elf_backend_plt_alignment): Define to 4.
ld/testsuite/
* ld-x86-64/x86-64.exp: Link some testcases with
--no-ld-generated-unwind-info.
* ld-x86-64/tlsbin.rd: Add --no-ld-generated-unwind-info to ld
comment.
* ld-x86-64/tlsdesc.dd: Likewise.
* ld-x86-64/tlspic.dd: Likewise.
* ld-x86-64/tlsdesc.sd: Likewise.
* ld-x86-64/tlspic.rd: Likewise.
* ld-x86-64/tlsbindesc.rd: Likewise.
* ld-x86-64/tlsbindesc.sd: Likewise.
* ld-x86-64/tlsbin.td: Likewise.
* ld-x86-64/tlsdesc.pd: Likewise.
* ld-x86-64/tlsdesc.td: Likewise.
* ld-x86-64/tlsbindesc.dd: Likewise.
* ld-x86-64/tlsbin.dd: Likewise.
* ld-x86-64/tlsgdesc.rd: Likewise.
* ld-x86-64/tlspic.sd: Likewise.
* ld-x86-64/tlsbindesc.td: Likewise.
* ld-x86-64/tlspic.td: Likewise.
* ld-x86-64/tlsbin.sd: Likewise.
* ld-x86-64/ilp32-4.d: Likewise.
* ld-x86-64/tlsgdesc.dd: Add --no-ld-generated-unwind-info to ld
comment. Adjust.
* ld-x86-64/tlsdesc.rd: Likewise.
* ld-x86-64/tlsgd6.dd: Adjust.
* ld-x86-64/tlsgd5.dd: Likewise.
* ld-i386/i386.exp: Link some testcases with
--no-ld-generated-unwind-info.
* ld-i386/tlsbin.rd: Add --no-ld-generated-unwind-info to ld
comment..
* ld-i386/tlsdesc.dd: Likewise.
* ld-i386/tlspic.dd: Likewise.
* ld-i386/tlsdesc.sd: Likewise.
* ld-i386/tlsgdesc.dd: Likewise.
* ld-i386/tlsnopic.sd: Likewise.
* ld-i386/tlspic.rd: Likewise.
* ld-i386/tlsdesc.rd: Likewise.
* ld-i386/tlsbindesc.rd: Likewise.
* ld-i386/tlsbindesc.sd: Likewise.
* ld-i386/tlsbin.td: Likewise.
* ld-i386/tlsdesc.td: Likewise.
* ld-i386/tlsnopic.dd: Likewise.
* ld-i386/tlsbindesc.dd: Likewise.
* ld-i386/tlsbin.dd: Likewise.
* ld-i386/tlsgdesc.rd: Likewise.
* ld-i386/tlspic.sd: Likewise.
* ld-i386/tlsnopic.rd: Likewise.
* ld-i386/tlsbindesc.td: Likewise.
* ld-i386/tlspic.td: Likewise.
* ld-i386/tlsbin.sd: Likewise.
--- include/bfdlink.h.jj 2011-05-20 16:52:51.000000000 +0200
+++ include/bfdlink.h 2011-06-20 09:32:12.000000000 +0200
@@ -353,6 +353,10 @@ struct bfd_link_info
--dynamic-list command line options. */
unsigned int dynamic: 1;
+ /* FALSE if .eh_frame unwind info should be generated for PLT and other
+ linker created sections, TRUE if it should be omitted. */
+ unsigned int no_ld_generated_unwind_info: 1;
+
/* Non-NULL if .note.gnu.build-id section should be created. */
char *emit_note_gnu_build_id;
--- ld/emultempl/elf32.em.jj 2011-06-08 12:52:05.000000000 +0200
+++ ld/emultempl/elf32.em 2011-06-20 09:32:50.000000000 +0200
@@ -2124,6 +2124,8 @@ fragment <<EOF
#define OPTION_HASH_STYLE (OPTION_EXCLUDE_LIBS + 1)
#define OPTION_BUILD_ID (OPTION_HASH_STYLE + 1)
#define OPTION_AUDIT (OPTION_BUILD_ID + 1)
+#define OPTION_LD_GENERATED_UNWIND_INFO (OPTION_AUDIT + 1)
+#define OPTION_NO_LD_GENERATED_UNWIND_INFO (OPTION_LD_GENERATED_UNWIND_INFO + 1)
static void
gld${EMULATION_NAME}_add_options
@@ -2144,6 +2146,10 @@ fragment <<EOF
{"eh-frame-hdr", no_argument, NULL, OPTION_EH_FRAME_HDR},
{"exclude-libs", required_argument, NULL, OPTION_EXCLUDE_LIBS},
{"hash-style", required_argument, NULL, OPTION_HASH_STYLE},
+ {"ld-generated-unwind-info", no_argument, NULL,
+ OPTION_LD_GENERATED_UNWIND_INFO},
+ {"no-ld-generated-unwind-info", no_argument, NULL,
+ OPTION_NO_LD_GENERATED_UNWIND_INFO},
{"Bgroup", no_argument, NULL, OPTION_GROUP},
EOF
fi
@@ -2209,6 +2215,14 @@ fragment <<EOF
link_info.eh_frame_hdr = TRUE;
break;
+ case OPTION_LD_GENERATED_UNWIND_INFO:
+ link_info.no_ld_generated_unwind_info = FALSE;
+ break;
+
+ case OPTION_NO_LD_GENERATED_UNWIND_INFO:
+ link_info.no_ld_generated_unwind_info = TRUE;
+ break;
+
case OPTION_GROUP:
link_info.flags_1 |= (bfd_vma) DF_1_GROUP;
/* Groups must be self-contained. */
--- ld/ld.texinfo.jj 2011-05-20 16:52:51.000000000 +0200
+++ ld/ld.texinfo 2011-06-20 09:24:09.000000000 +0200
@@ -2069,6 +2069,12 @@ call before the linker has a chance to w
Request creation of @code{.eh_frame_hdr} section and ELF
@code{PT_GNU_EH_FRAME} segment header.
+@kindex --ld-generated-unwind-info
+@item --no-ld-generated-unwind-info
+Request creation of @code{.eh_frame} unwind info for linker
+generated code sections like PLT. This option is on by default
+if linker generated unwind info is supported.
+
@kindex --enable-new-dtags
@kindex --disable-new-dtags
@item --enable-new-dtags
--- bfd/elf64-x86-64.c.jj 2011-06-14 08:59:45.000000000 +0200
+++ bfd/elf64-x86-64.c 2011-06-20 09:34:59.000000000 +0200
@@ -29,6 +29,7 @@
#include "bfd_stdint.h"
#include "objalloc.h"
#include "hashtab.h"
+#include "dwarf2.h"
#include "elf/x86-64.h"
@@ -408,6 +409,45 @@ static const bfd_byte elf_x86_64_plt_ent
0, 0, 0, 0 /* replaced with offset to start of .plt0. */
};
+/* .eh_frame covering the .plt section. */
+
+static const bfd_byte elf_x86_64_eh_frame_plt[] =
+{
+#define PLT_CIE_LENGTH 20
+#define PLT_FDE_LENGTH 36
+#define PLT_FDE_START_OFFSET 4 + PLT_CIE_LENGTH + 8
+#define PLT_FDE_LEN_OFFSET 4 + PLT_CIE_LENGTH + 12
+ PLT_CIE_LENGTH, 0, 0, 0, /* CIE length */
+ 0, 0, 0, 0, /* CIE ID */
+ 1, /* CIE version */
+ 'z', 'R', 0, /* Augmentation string */
+ 1, /* Code alignment factor */
+ 0x78, /* Data alignment factor */
+ 16, /* Return address column */
+ 1, /* Augmentation size */
+ DW_EH_PE_pcrel | DW_EH_PE_sdata4, /* FDE encoding */
+ DW_CFA_def_cfa, 7, 8, /* DW_CFA_def_cfa: r7 (rsp) ofs 8 */
+ DW_CFA_offset + 16, 1, /* DW_CFA_offset: r16 (rip) at cfa-8 */
+ DW_CFA_nop, DW_CFA_nop,
+
+ PLT_FDE_LENGTH, 0, 0, 0, /* FDE length */
+ PLT_CIE_LENGTH + 8, 0, 0, 0, /* CIE pointer */
+ 0, 0, 0, 0, /* R_X86_64_PC32 .plt goes here */
+ 0, 0, 0, 0, /* .plt size goes here */
+ 0, /* Augmentation size */
+ DW_CFA_def_cfa_offset, 16, /* DW_CFA_def_cfa_offset: 16 */
+ DW_CFA_advance_loc + 6, /* DW_CFA_advance_loc: 6 to __PLT__+6 */
+ DW_CFA_def_cfa_offset, 24, /* DW_CFA_def_cfa_offset: 24 */
+ DW_CFA_advance_loc + 10, /* DW_CFA_advance_loc: 10 to __PLT__+16 */
+ DW_CFA_def_cfa_expression, /* DW_CFA_def_cfa_expression */
+ 11, /* Block length */
+ DW_OP_breg7, 8, /* DW_OP_breg7 (rsp): 8 */
+ DW_OP_breg16, 0, /* 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
+};
+
/* x86-64 ELF linker hash entry. */
struct elf_x86_64_link_hash_entry
@@ -481,6 +521,7 @@ struct elf_x86_64_link_hash_table
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
+ asection *plt_eh_frame;
union
{
@@ -727,6 +768,24 @@ elf_x86_64_create_dynamic_sections (bfd
|| (!info->shared && !htab->srelbss))
abort ();
+ if (!info->no_ld_generated_unwind_info
+ && bfd_get_section_by_name (dynobj, ".eh_frame") == NULL
+ && htab->elf.splt != NULL)
+ {
+ flagword flags = get_elf_backend_data (dynobj)->dynamic_sec_flags;
+ htab->plt_eh_frame
+ = bfd_make_section_with_flags (dynobj, ".eh_frame",
+ flags | SEC_READONLY);
+ if (htab->plt_eh_frame == NULL
+ || !bfd_set_section_alignment (dynobj, htab->plt_eh_frame, 3))
+ return FALSE;
+
+ htab->plt_eh_frame->size = sizeof (elf_x86_64_eh_frame_plt);
+ htab->plt_eh_frame->contents
+ = bfd_alloc (dynobj, htab->plt_eh_frame->size);
+ memcpy (htab->plt_eh_frame->contents, elf_x86_64_eh_frame_plt,
+ sizeof (elf_x86_64_eh_frame_plt));
+ }
return TRUE;
}
@@ -2601,6 +2660,13 @@ elf_x86_64_size_dynamic_sections (bfd *o
return FALSE;
}
+ if (htab->plt_eh_frame != NULL
+ && htab->elf.splt != NULL
+ && htab->elf.splt->size != 0
+ && (htab->elf.splt->flags & SEC_EXCLUDE) == 0)
+ bfd_put_32 (dynobj, htab->elf.splt->size,
+ htab->plt_eh_frame->contents + PLT_FDE_LEN_OFFSET);
+
if (htab->elf.dynamic_sections_created)
{
/* Add some entries to the .dynamic section. We fill in the
@@ -4401,6 +4467,33 @@ elf_x86_64_finish_dynamic_sections (bfd
GOT_ENTRY_SIZE;
}
+ /* Adjust .eh_frame for .plt section. */
+ if (htab->plt_eh_frame != NULL)
+ {
+ if (htab->elf.splt != NULL
+ && htab->elf.splt->size != 0
+ && (htab->elf.splt->flags & SEC_EXCLUDE) == 0
+ && htab->elf.splt->output_section != NULL
+ && htab->plt_eh_frame->output_section != NULL)
+ {
+ bfd_vma plt_start = htab->elf.splt->output_section->vma;
+ bfd_vma eh_frame_start = htab->plt_eh_frame->output_section->vma
+ + htab->plt_eh_frame->output_offset
+ + PLT_FDE_START_OFFSET;
+ bfd_put_signed_32 (dynobj, plt_start - eh_frame_start,
+ htab->plt_eh_frame->contents
+ + PLT_FDE_START_OFFSET);
+ }
+ if (htab->plt_eh_frame->sec_info_type
+ == ELF_INFO_TYPE_EH_FRAME)
+ {
+ if (! _bfd_elf_write_section_eh_frame (output_bfd, info,
+ htab->plt_eh_frame,
+ htab->plt_eh_frame->contents))
+ return FALSE;
+ }
+ }
+
if (htab->elf.sgot && htab->elf.sgot->size > 0)
elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize
= GOT_ENTRY_SIZE;
@@ -4667,6 +4760,7 @@ static const struct bfd_elf_special_sect
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size (GOT_ENTRY_SIZE*3)
#define elf_backend_rela_normal 1
+#define elf_backend_plt_alignment 4
#define elf_info_to_howto elf_x86_64_info_to_howto
--- bfd/elf32-i386.c.jj 2011-06-14 08:59:45.000000000 +0200
+++ bfd/elf32-i386.c 2011-06-20 09:35:28.000000000 +0200
@@ -29,6 +29,7 @@
#include "bfd_stdint.h"
#include "objalloc.h"
#include "hashtab.h"
+#include "dwarf2.h"
/* 386 uses REL relocations instead of RELA. */
#define USE_REL 1
@@ -574,6 +575,45 @@ static const bfd_byte elf_i386_pic_plt_e
0, 0, 0, 0 /* replaced with offset to start of .plt. */
};
+/* .eh_frame covering the .plt section. */
+
+static const bfd_byte elf_i386_eh_frame_plt[] =
+{
+#define PLT_CIE_LENGTH 20
+#define PLT_FDE_LENGTH 36
+#define PLT_FDE_START_OFFSET 4 + PLT_CIE_LENGTH + 8
+#define PLT_FDE_LEN_OFFSET 4 + PLT_CIE_LENGTH + 12
+ PLT_CIE_LENGTH, 0, 0, 0, /* CIE length */
+ 0, 0, 0, 0, /* CIE ID */
+ 1, /* CIE version */
+ 'z', 'R', 0, /* Augmentation string */
+ 1, /* Code alignment factor */
+ 0x7c, /* Data alignment factor */
+ 8, /* Return address column */
+ 1, /* Augmentation size */
+ DW_EH_PE_pcrel | DW_EH_PE_sdata4, /* FDE encoding */
+ DW_CFA_def_cfa, 4, 4, /* DW_CFA_def_cfa: r4 (esp) ofs 4 */
+ DW_CFA_offset + 8, 1, /* DW_CFA_offset: r8 (eip) at cfa-4 */
+ DW_CFA_nop, DW_CFA_nop,
+
+ PLT_FDE_LENGTH, 0, 0, 0, /* FDE length */
+ PLT_CIE_LENGTH + 8, 0, 0, 0, /* CIE pointer */
+ 0, 0, 0, 0, /* R_386_PC32 .plt goes here */
+ 0, 0, 0, 0, /* .plt size goes here */
+ 0, /* Augmentation size */
+ DW_CFA_def_cfa_offset, 8, /* DW_CFA_def_cfa_offset: 8 */
+ DW_CFA_advance_loc + 6, /* DW_CFA_advance_loc: 6 to __PLT__+6 */
+ DW_CFA_def_cfa_offset, 12, /* DW_CFA_def_cfa_offset: 12 */
+ DW_CFA_advance_loc + 10, /* DW_CFA_advance_loc: 10 to __PLT__+16 */
+ DW_CFA_def_cfa_expression, /* DW_CFA_def_cfa_expression */
+ 11, /* Block length */
+ DW_OP_breg4, 4, /* DW_OP_breg4 (esp): 4 */
+ DW_OP_breg8, 0, /* DW_OP_breg8 (eip): 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
+};
+
/* On VxWorks, the .rel.plt.unloaded section has absolute relocations
for the PLTResolve stub and then for each PLT entry. */
#define PLTRESOLVE_RELOCS_SHLIB 0
@@ -655,6 +695,7 @@ struct elf_i386_link_hash_table
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
+ asection *plt_eh_frame;
union
{
@@ -887,6 +928,25 @@ elf_i386_create_dynamic_sections (bfd *d
&htab->srelplt2))
return FALSE;
+ if (!info->no_ld_generated_unwind_info
+ && bfd_get_section_by_name (dynobj, ".eh_frame") == NULL
+ && htab->elf.splt != NULL)
+ {
+ flagword flags = get_elf_backend_data (dynobj)->dynamic_sec_flags;
+ htab->plt_eh_frame
+ = bfd_make_section_with_flags (dynobj, ".eh_frame",
+ flags | SEC_READONLY);
+ if (htab->plt_eh_frame == NULL
+ || !bfd_set_section_alignment (dynobj, htab->plt_eh_frame, 2))
+ return FALSE;
+
+ htab->plt_eh_frame->size = sizeof (elf_i386_eh_frame_plt);
+ htab->plt_eh_frame->contents
+ = bfd_alloc (dynobj, htab->plt_eh_frame->size);
+ memcpy (htab->plt_eh_frame->contents, elf_i386_eh_frame_plt,
+ sizeof (elf_i386_eh_frame_plt));
+ }
+
return TRUE;
}
@@ -2667,6 +2727,13 @@ elf_i386_size_dynamic_sections (bfd *out
return FALSE;
}
+ if (htab->plt_eh_frame != NULL
+ && htab->elf.splt != NULL
+ && htab->elf.splt->size != 0
+ && (htab->elf.splt->flags & SEC_EXCLUDE) == 0)
+ bfd_put_32 (dynobj, htab->elf.splt->size,
+ htab->plt_eh_frame->contents + PLT_FDE_LEN_OFFSET);
+
if (htab->elf.dynamic_sections_created)
{
/* Add some entries to the .dynamic section. We fill in the
@@ -4667,6 +4734,33 @@ elf_i386_finish_dynamic_sections (bfd *o
elf_section_data (htab->elf.sgotplt->output_section)->this_hdr.sh_entsize = 4;
}
+ /* Adjust .eh_frame for .plt section. */
+ if (htab->plt_eh_frame != NULL)
+ {
+ if (htab->elf.splt != NULL
+ && htab->elf.splt->size != 0
+ && (htab->elf.splt->flags & SEC_EXCLUDE) == 0
+ && htab->elf.splt->output_section != NULL
+ && htab->plt_eh_frame->output_section != NULL)
+ {
+ bfd_vma plt_start = htab->elf.splt->output_section->vma;
+ bfd_vma eh_frame_start = htab->plt_eh_frame->output_section->vma
+ + htab->plt_eh_frame->output_offset
+ + PLT_FDE_START_OFFSET;
+ bfd_put_signed_32 (dynobj, plt_start - eh_frame_start,
+ htab->plt_eh_frame->contents
+ + PLT_FDE_START_OFFSET);
+ }
+ if (htab->plt_eh_frame->sec_info_type
+ == ELF_INFO_TYPE_EH_FRAME)
+ {
+ if (! _bfd_elf_write_section_eh_frame (output_bfd, info,
+ htab->plt_eh_frame,
+ htab->plt_eh_frame->contents))
+ return FALSE;
+ }
+ }
+
if (htab->elf.sgot && htab->elf.sgot->size > 0)
elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4;
@@ -4734,6 +4828,7 @@ elf_i386_add_symbol_hook (bfd * abfd,
#define elf_backend_plt_readonly 1
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size 12
+#define elf_backend_plt_alignment 4
/* Support RELA for objdump of prelink objects. */
#define elf_info_to_howto elf_i386_info_to_howto_rel
--- bfd/elf-eh-frame.c.jj 2011-03-16 10:27:06.000000000 +0100
+++ bfd/elf-eh-frame.c 2011-06-14 20:33:15.000000000 +0200
@@ -777,8 +777,6 @@ _bfd_elf_parse_eh_frame (bfd *abfd, stru
}
else
{
- asection *rsec;
-
/* Find the corresponding CIE. */
unsigned int cie_offset = this_inf->offset + 4 - hdr_id;
for (cie = local_cies; cie < local_cies + cie_count; cie++)
@@ -794,17 +792,22 @@ _bfd_elf_parse_eh_frame (bfd *abfd, stru
= cie->cie_inf->add_augmentation_size;
ENSURE_NO_RELOCS (buf);
- REQUIRE (GET_RELOC (buf));
-
- /* Chain together the FDEs for each section. */
- rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie);
- /* RSEC will be NULL if FDE was cleared out as it was belonging to
- a discarded SHT_GROUP. */
- if (rsec)
+ if ((sec->flags & SEC_LINKER_CREATED) == 0 || cookie->rels != NULL)
{
- REQUIRE (rsec->owner == abfd);
- this_inf->u.fde.next_for_section = elf_fde_list (rsec);
- elf_fde_list (rsec) = this_inf;
+ asection *rsec;
+
+ REQUIRE (GET_RELOC (buf));
+
+ /* Chain together the FDEs for each section. */
+ rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie);
+ /* RSEC will be NULL if FDE was cleared out as it was belonging to
+ a discarded SHT_GROUP. */
+ if (rsec)
+ {
+ REQUIRE (rsec->owner == abfd);
+ this_inf->u.fde.next_for_section = elf_fde_list (rsec);
+ elf_fde_list (rsec) = this_inf;
+ }
}
/* Skip the initial location and address range. */
@@ -1137,6 +1140,9 @@ _bfd_elf_discard_section_eh_frame
if (sec_info == NULL)
return FALSE;
+ ptr_size = (get_elf_backend_data (sec->owner)
+ ->elf_backend_eh_frame_address_size (sec->owner, sec));
+
hdr_info = &elf_hash_table (info)->eh_info;
for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent)
if (ent->size == 4)
@@ -1145,11 +1151,25 @@ _bfd_elf_discard_section_eh_frame
ent->removed = sec->map_head.s != NULL;
else if (!ent->cie)
{
- cookie->rel = cookie->rels + ent->reloc_index;
- /* FIXME: octets_per_byte. */
- BFD_ASSERT (cookie->rel < cookie->relend
- && cookie->rel->r_offset == ent->offset + 8);
- if (!(*reloc_symbol_deleted_p) (ent->offset + 8, cookie))
+ bfd_boolean keep;
+ if ((sec->flags & SEC_LINKER_CREATED) != 0 && cookie->rels == NULL)
+ {
+ unsigned int width
+ = get_DW_EH_PE_width (ent->fde_encoding, ptr_size);
+ bfd_vma value
+ = read_value (abfd, sec->contents + ent->offset + 8 + width,
+ width, get_DW_EH_PE_signed (ent->fde_encoding));
+ keep = value != 0;
+ }
+ else
+ {
+ cookie->rel = cookie->rels + ent->reloc_index;
+ /* FIXME: octets_per_byte. */
+ BFD_ASSERT (cookie->rel < cookie->relend
+ && cookie->rel->r_offset == ent->offset + 8);
+ keep = !(*reloc_symbol_deleted_p) (ent->offset + 8, cookie);
+ }
+ if (keep)
{
if (info->shared
&& (((ent->fde_encoding & 0x70) == DW_EH_PE_absptr
@@ -1178,8 +1198,6 @@ _bfd_elf_discard_section_eh_frame
sec_info->cies = NULL;
}
- ptr_size = (get_elf_backend_data (sec->owner)
- ->elf_backend_eh_frame_address_size (sec->owner, sec));
offset = 0;
for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent)
if (!ent->removed)
--- ld/testsuite/ld-x86-64/tlsbin.rd.jj 2011-06-08 12:52:07.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsbin.rd 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbinpic.s
#source: tlsbin.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#readelf: -WSsrl
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlsgd6.dd.jj 2011-03-12 15:38:31.000000000 +0100
+++ ld/testsuite/ld-x86-64/tlsgd6.dd 2011-06-20 10:37:21.000000000 +0200
@@ -10,5 +10,5 @@ Disassembly of section .text:
[a-f0-9]+ <_start>:
[ ]*[a-f0-9]+: 64 8b 04 25 00 00 00 00 mov %fs:0x0,%eax
-[ ]*[a-f0-9]+: 48 03 05 81 00 20 00 add 0x200081\(%rip\),%rax # 60022c <_DYNAMIC\+0x80>
+[ ]*[a-f0-9]+: 48 03 05 c5 00 20 00 add 0x2000c5\(%rip\),%rax # 600270 <_DYNAMIC\+0x80>
#pass
--- ld/testsuite/ld-x86-64/tlsdesc.dd.jj 2007-04-27 06:22:01.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsdesc.dd 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsdesc.s
#source: tlspic2.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -drj.text
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlspic.dd.jj 2009-11-13 21:42:10.000000000 +0100
+++ ld/testsuite/ld-x86-64/tlspic.dd 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlspic1.s
#source: tlspic2.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -drj.text
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlsdesc.sd.jj 2006-05-26 04:44:19.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsdesc.sd 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsdesc.s
#source: tlspic2.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -s -j.got -j.got.plt
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlsgdesc.dd.jj 2009-11-13 21:42:10.000000000 +0100
+++ ld/testsuite/ld-x86-64/tlsgdesc.dd 2011-06-20 10:44:34.000000000 +0200
@@ -1,6 +1,6 @@
#source: tlsgdesc.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -drj.text
#target: x86_64-*-*
@@ -20,7 +20,7 @@ Disassembly of section .text:
+[0-9a-f]+: 00 00 *
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
- +[0-9a-f]+: 48 03 0d 5e 02 20 00[ ]+add 0x20025e\(%rip\),%rcx +# 200660 <.*>
+ +[0-9a-f]+: 48 03 0d 5e 02 20 00[ ]+add 0x20025e\(%rip\),%rcx +# 200668 <.*>
# -> R_X86_64_TPOFF64 sG3
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
@@ -31,14 +31,14 @@ Disassembly of section .text:
+[0-9a-f]+: 00 00 *
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
- +[0-9a-f]+: 48 03 0d 68 02 20 00[ ]+add 0x200268\(%rip\),%rcx +# 200680 <.*>
+ +[0-9a-f]+: 48 03 0d 68 02 20 00[ ]+add 0x200268\(%rip\),%rcx +# 200688 <.*>
# -> R_X86_64_TPOFF64 sG4
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
# GD, gd first
- +[0-9a-f]+: 66 48 8d 3d 6c 02 20[ ]+data32 lea 0x20026c\(%rip\),%rdi +# 200690 <.*>
+ +[0-9a-f]+: 66 48 8d 3d 6c 02 20[ ]+data32 lea 0x20026c\(%rip\),%rdi +# 200698 <.*>
+[0-9a-f]+: 00 *
# -> R_X86_64_DTPMOD64 sG1
+[0-9a-f]+: 66 66 48 e8 9c ff ff[ ]+data32 data32 callq [0-9a-f]+ <.*>
@@ -48,7 +48,7 @@ Disassembly of section .text:
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
- +[0-9a-f]+: 48 8d 05 a1 02 20 00[ ]+lea 0x2002a1\(%rip\),%rax +# 2006d8 <.*>
+ +[0-9a-f]+: 48 8d 05 a1 02 20 00[ ]+lea 0x2002a1\(%rip\),%rax +# 2006e0 <.*>
# -> R_X86_64_TLSDESC sG1
+[0-9a-f]+: ff 10[ ]+callq \*\(%rax\)
+[0-9a-f]+: 90[ ]+nop *
@@ -56,14 +56,14 @@ Disassembly of section .text:
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
# GD, desc first
- +[0-9a-f]+: 48 8d 05 84 02 20 00[ ]+lea 0x200284\(%rip\),%rax +# 2006c8 <.*>
+ +[0-9a-f]+: 48 8d 05 84 02 20 00[ ]+lea 0x200284\(%rip\),%rax +# 2006d0 <.*>
# -> R_X86_64_TLSDESC sG2
+[0-9a-f]+: ff 10[ ]+callq \*\(%rax\)
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
- +[0-9a-f]+: 66 48 8d 3d 1e 02 20[ ]+data32 lea 0x20021e\(%rip\),%rdi +# 200670 <.*>
+ +[0-9a-f]+: 66 48 8d 3d 1e 02 20[ ]+data32 lea 0x20021e\(%rip\),%rdi +# 200678 <.*>
+[0-9a-f]+: 00 *
# -> R_X86_64_DTPMOD64 sG2
+[0-9a-f]+: 66 66 48 e8 6e ff ff[ ]+data32 data32 callq [0-9a-f]+ <.*>
@@ -76,13 +76,13 @@ Disassembly of section .text:
# GD -> IE, gd first, after IE use
+[0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+[0-9a-f]+: 00 00 *
- +[0-9a-f]+: 48 03 05 f2 01 20 00[ ]+add 0x2001f2\(%rip\),%rax +# 200660 <.*>
+ +[0-9a-f]+: 48 03 05 f2 01 20 00[ ]+add 0x2001f2\(%rip\),%rax +# 200668 <.*>
# -> R_X86_64_TPOFF64 sG3
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
- +[0-9a-f]+: 48 8b 05 e7 01 20 00[ ]+mov 0x2001e7\(%rip\),%rax +# 200660 <.*>
+ +[0-9a-f]+: 48 8b 05 e7 01 20 00[ ]+mov 0x2001e7\(%rip\),%rax +# 200668 <.*>
# -> R_X86_64_TPOFF64 sG3
+[0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+[0-9a-f]+: 90[ ]+nop *
@@ -90,7 +90,7 @@ Disassembly of section .text:
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
# GD -> IE, desc first, after IE use
- +[0-9a-f]+: 48 8b 05 fa 01 20 00[ ]+mov 0x2001fa\(%rip\),%rax +# 200680 <.*>
+ +[0-9a-f]+: 48 8b 05 fa 01 20 00[ ]+mov 0x2001fa\(%rip\),%rax +# 200688 <.*>
# -> R_X86_64_TPOFF64 sG4
+[0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+[0-9a-f]+: 90[ ]+nop *
@@ -99,7 +99,7 @@ Disassembly of section .text:
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+[0-9a-f]+: 00 00 *
- +[0-9a-f]+: 48 03 05 e4 01 20 00[ ]+add 0x2001e4\(%rip\),%rax +# 200680 <.*>
+ +[0-9a-f]+: 48 03 05 e4 01 20 00[ ]+add 0x2001e4\(%rip\),%rax +# 200688 <.*>
# -> R_X86_64_TPOFF64 sG4
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
@@ -108,13 +108,13 @@ Disassembly of section .text:
# GD -> IE, gd first, before IE use
+[0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+[0-9a-f]+: 00 00 *
- +[0-9a-f]+: 48 03 05 b8 01 20 00[ ]+add 0x2001b8\(%rip\),%rax +# 200668 <.*>
+ +[0-9a-f]+: 48 03 05 b8 01 20 00[ ]+add 0x2001b8\(%rip\),%rax +# 200670 <.*>
# -> R_X86_64_TPOFF64 sG5
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
- +[0-9a-f]+: 48 8b 05 ad 01 20 00[ ]+mov 0x2001ad\(%rip\),%rax +# 200668 <.*>
+ +[0-9a-f]+: 48 8b 05 ad 01 20 00[ ]+mov 0x2001ad\(%rip\),%rax +# 200670 <.*>
# -> R_X86_64_TPOFF64 sG5
+[0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+[0-9a-f]+: 90[ ]+nop *
@@ -122,7 +122,7 @@ Disassembly of section .text:
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
# GD -> IE, desc first, before IE use
- +[0-9a-f]+: 48 8b 05 c0 01 20 00[ ]+mov 0x2001c0\(%rip\),%rax +# 200688 <.*>
+ +[0-9a-f]+: 48 8b 05 c0 01 20 00[ ]+mov 0x2001c0\(%rip\),%rax +# 200690 <.*>
# -> R_X86_64_TPOFF64 sG6
+[0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+[0-9a-f]+: 90[ ]+nop *
@@ -131,7 +131,7 @@ Disassembly of section .text:
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+[0-9a-f]+: 00 00 *
- +[0-9a-f]+: 48 03 05 aa 01 20 00[ ]+add 0x2001aa\(%rip\),%rax +# 200688 <.*>
+ +[0-9a-f]+: 48 03 05 aa 01 20 00[ ]+add 0x2001aa\(%rip\),%rax +# 200690 <.*>
# -> R_X86_64_TPOFF64 sG6
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
@@ -142,7 +142,7 @@ Disassembly of section .text:
+[0-9a-f]+: 00 00 *
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
- +[0-9a-f]+: 48 03 0d 74 01 20 00[ ]+add 0x200174\(%rip\),%rcx +# 200668 <.*>
+ +[0-9a-f]+: 48 03 0d 74 01 20 00[ ]+add 0x200174\(%rip\),%rcx +# 200670 <.*>
# -> R_X86_64_TPOFF64 sG5
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
@@ -153,7 +153,7 @@ Disassembly of section .text:
+[0-9a-f]+: 00 00 *
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
- +[0-9a-f]+: 48 03 0d 7e 01 20 00[ ]+add 0x20017e\(%rip\),%rcx +# 200688 <.*>
+ +[0-9a-f]+: 48 03 0d 7e 01 20 00[ ]+add 0x20017e\(%rip\),%rcx +# 200690 <.*>
# -> R_X86_64_TPOFF64 sG6
+[0-9a-f]+: 90[ ]+nop *
+[0-9a-f]+: 90[ ]+nop *
--- ld/testsuite/ld-x86-64/tlsgd5.dd.jj 2011-03-12 15:38:31.000000000 +0100
+++ ld/testsuite/ld-x86-64/tlsgd5.dd 2011-06-20 10:37:29.000000000 +0200
@@ -10,5 +10,5 @@ Disassembly of section .text:
[a-f0-9]+ <_start>:
[ ]*[a-f0-9]+: 64 48 8b 04 25 00 00 00 00 mov %fs:0x0,%rax
-[ ]*[a-f0-9]+: 48 03 05 00 01 20 00 add 0x200100\(%rip\),%rax # 600368 <_DYNAMIC\+0x100>
+[ ]*[a-f0-9]+: 48 03 05 40 01 20 00 add 0x200140\(%rip\),%rax # 6003a8 <_DYNAMIC\+0x100>
#pass
--- ld/testsuite/ld-x86-64/tlspic.rd.jj 2009-09-24 17:56:52.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlspic.rd 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlspic1.s
#source: tlspic2.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#readelf: -WSsrl
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlsdesc.rd.jj 2009-09-24 17:56:52.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsdesc.rd 2011-06-20 10:32:17.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsdesc.s
#source: tlspic2.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#readelf: -WSsrld
#target: x86_64-*-*
@@ -15,7 +15,7 @@ Section Headers:
+\[[ 0-9]+\] .dynstr +.*
+\[[ 0-9]+\] .rela.dyn +.*
+\[[ 0-9]+\] .rela.plt +.*
- +\[[ 0-9]+\] .plt +PROGBITS +0+450 0+450 0+20 10 +AX +0 +0 +4
+ +\[[ 0-9]+\] .plt +PROGBITS +0+450 0+450 0+20 10 +AX +0 +0 +(4|16)
+\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+154 00 +AX +0 +0 4096
+\[[ 0-9]+\] .tdata +PROGBITS +0+201154 0+1154 0+60 00 WAT +0 +0 +1
+\[[ 0-9]+\] .tbss +NOBITS +0+2011b4 0+11b4 0+20 00 WAT +0 +0 +1
--- ld/testsuite/ld-x86-64/x86-64.exp.jj 2011-06-14 08:59:49.000000000 +0200
+++ ld/testsuite/ld-x86-64/x86-64.exp 2011-06-20 10:47:12.000000000 +0200
@@ -38,12 +38,14 @@ if { !([istarget "x86_64-*-elf*"]
# readelf: Apply readelf options on result. Compare with regex (last arg).
set x86_64tests {
- {"TLS -fpic -shared transitions" "-shared -melf_x86_64"
+ {"TLS -fpic -shared transitions"
+ "-shared -melf_x86_64 --no-ld-generated-unwind-info"
"--64" {tlspic1.s tlspic2.s}
{{readelf -WSsrl tlspic.rd} {objdump -drj.text tlspic.dd}
{objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
"libtlspic.so"}
- {"TLS descriptor -fpic -shared transitions" "-shared -melf_x86_64"
+ {"TLS descriptor -fpic -shared transitions"
+ "-shared -melf_x86_64 --no-ld-generated-unwind-info"
"--64" {tlsdesc.s tlspic2.s}
{{readelf -WSsrld tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
{objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}
@@ -51,17 +53,20 @@ set x86_64tests {
{"Helper shared library" "-shared -melf_x86_64"
"--64" {tlslib.s} {} "libtlslib.so"}
{"TLS -fpic and -fno-pic exec transitions"
- "-melf_x86_64 tmpdir/libtlslib.so" "--64" {tlsbinpic.s tlsbin.s}
+ "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info"
+ "--64" {tlsbinpic.s tlsbin.s}
{{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd}
{objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}}
"tlsbin"}
{"TLS descriptor -fpic and -fno-pic exec transitions"
- "-melf_x86_64 tmpdir/libtlslib.so" "--64" {tlsbindesc.s tlsbin.s}
+ "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info"
+ "--64" {tlsbindesc.s tlsbin.s}
{{readelf -WSsrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
{objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
"tlsbindesc"}
{"TLS with global dynamic and descriptors"
- "-shared -melf_x86_64" "--64" {tlsgdesc.s}
+ "-shared -melf_x86_64 --no-ld-generated-unwind-info"
+ "--64" {tlsgdesc.s}
{{readelf -WSsrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}}
"libtlsgdesc.so"}
{"TLS in debug sections" "-melf_x86_64"
--- ld/testsuite/ld-x86-64/tlsbindesc.rd.jj 2011-06-08 12:52:07.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsbindesc.rd 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbindesc.s
#source: tlsbin.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#readelf: -WSsrl
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlsbindesc.sd.jj 2011-06-08 12:52:07.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsbindesc.sd 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbindesc.s
#source: tlsbin.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -sj.got
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlsbin.td.jj 2011-06-08 12:52:07.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsbin.td 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbinpic.s
#source: tlsbin.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -sj.tdata
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlsdesc.pd.jj 2006-10-17 15:41:49.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsdesc.pd 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsdesc.s
#source: tlspic2.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -drj.plt
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlsdesc.td.jj 2006-05-26 04:44:19.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsdesc.td 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsdesc.s
#source: tlspic2.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -sj.tdata
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlsbindesc.dd.jj 2011-06-08 12:52:07.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsbindesc.dd 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbindesc.s
#source: tlsbin.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -drj.text
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlsbin.dd.jj 2011-06-08 12:52:07.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsbin.dd 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbinpic.s
#source: tlsbin.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -drj.text
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlsgdesc.rd.jj 2009-09-24 17:56:52.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsgdesc.rd 2011-06-20 10:27:27.000000000 +0200
@@ -1,6 +1,6 @@
#source: tlsgdesc.s
#as: --64
-#ld: -shared -melf64_x86_64
+#ld: -shared -melf64_x86_64 --no-ld-generated-unwind-info
#readelf: -WSsrl
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlspic.sd.jj 2006-05-26 04:44:19.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlspic.sd 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlspic1.s
#source: tlspic2.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -sj.got
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlsbindesc.td.jj 2011-06-08 12:52:07.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsbindesc.td 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbindesc.s
#source: tlsbin.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -sj.tdata
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlspic.td.jj 2006-05-26 04:44:19.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlspic.td 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlspic1.s
#source: tlspic2.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -sj.tdata
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/tlsbin.sd.jj 2011-06-08 12:52:07.000000000 +0200
+++ ld/testsuite/ld-x86-64/tlsbin.sd 2011-06-20 10:27:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbinpic.s
#source: tlsbin.s
#as: --64
-#ld: -shared -melf_x86_64
+#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info
#objdump: -sj.got
#target: x86_64-*-*
--- ld/testsuite/ld-x86-64/ilp32-4.d.jj 2011-01-18 21:41:09.000000000 +0100
+++ ld/testsuite/ld-x86-64/ilp32-4.d 2011-06-20 10:48:40.000000000 +0200
@@ -1,6 +1,6 @@
#source: start.s
#as: --x32
-#ld: -m elf32_x86_64 -shared
+#ld: -m elf32_x86_64 -shared --no-ld-generated-unwind-info
#readelf: -d -S --wide
There are 10 section headers, starting at offset 0x22c:
--- ld/testsuite/ld-i386/tlsbin.rd.jj 2009-09-24 17:56:51.000000000 +0200
+++ ld/testsuite/ld-i386/tlsbin.rd 2011-06-20 10:11:04.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbinpic.s
#source: tlsbin.s
#as: --32
-#ld: -melf_i386 tmpdir/libtlslib.so
+#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info
#readelf: -Ssrl
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsdesc.dd.jj 2007-04-27 06:22:00.000000000 +0200
+++ ld/testsuite/ld-i386/tlsdesc.dd 2011-06-20 10:10:15.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsdesc.s
#source: tlspic2.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --no-ld-generated-unwind-info
#objdump: -drj.text
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlspic.dd.jj 2007-04-27 06:22:00.000000000 +0200
+++ ld/testsuite/ld-i386/tlspic.dd 2011-06-20 10:08:32.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlspic1.s
#source: tlspic2.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --no-ld-generated-unwind-info
#objdump: -drj.text
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsdesc.sd.jj 2006-10-17 15:41:48.000000000 +0200
+++ ld/testsuite/ld-i386/tlsdesc.sd 2011-06-20 10:10:01.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsdesc.s
#source: tlspic2.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --no-ld-generated-unwind-info
#objdump: -s -j.got -j.got.plt
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsgdesc.dd.jj 2007-04-27 06:22:00.000000000 +0200
+++ ld/testsuite/ld-i386/tlsgdesc.dd 2011-06-20 10:09:33.000000000 +0200
@@ -1,6 +1,6 @@
#source: tlsgdesc.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --no-ld-generated-unwind-info
#objdump: -drj.text
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsnopic.sd.jj 2005-07-08 08:22:03.000000000 +0200
+++ ld/testsuite/ld-i386/tlsnopic.sd 2011-06-20 10:09:06.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsnopic1.s
#source: tlsnopic2.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --no-ld-generated-unwind-info
#objdump: -sj.got
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlspic.rd.jj 2009-09-24 17:56:51.000000000 +0200
+++ ld/testsuite/ld-i386/tlspic.rd 2011-06-20 10:08:27.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlspic1.s
#source: tlspic2.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --no-ld-generated-unwind-info
#readelf: -Ssrl
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsdesc.rd.jj 2009-09-24 17:56:51.000000000 +0200
+++ ld/testsuite/ld-i386/tlsdesc.rd 2011-06-20 10:10:08.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsdesc.s
#source: tlspic2.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --no-ld-generated-unwind-info
#readelf: -Ssrl
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsbindesc.rd.jj 2009-09-24 17:56:51.000000000 +0200
+++ ld/testsuite/ld-i386/tlsbindesc.rd 2011-06-20 10:10:37.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbindesc.s
#source: tlsbin.s
#as: --32
-#ld: -melf_i386 tmpdir/libtlslib.so
+#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info
#readelf: -Ssrl
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsbindesc.sd.jj 2006-01-18 22:07:49.000000000 +0100
+++ ld/testsuite/ld-i386/tlsbindesc.sd 2011-06-20 10:10:31.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbindesc.s
#source: tlsbin.s
#as: --32
-#ld: -melf_i386 tmpdir/libtlslib.so
+#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info
#objdump: -sj.got
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsbin.td.jj 2002-09-19 21:01:15.000000000 +0200
+++ ld/testsuite/ld-i386/tlsbin.td 2011-06-20 10:10:50.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbinpic.s
#source: tlsbin.s
#as: --32
-#ld: -melf_i386 tmpdir/libtlslib.so
+#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info
#objdump: -sj.tdata
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsdesc.td.jj 2006-01-18 22:07:49.000000000 +0100
+++ ld/testsuite/ld-i386/tlsdesc.td 2011-06-20 10:09:53.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsdesc.s
#source: tlspic2.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --no-ld-generated-unwind-info
#objdump: -sj.tdata
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsnopic.dd.jj 2007-04-27 06:22:00.000000000 +0200
+++ ld/testsuite/ld-i386/tlsnopic.dd 2011-06-20 10:08:47.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsnopic1.s
#source: tlsnopic2.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --no-ld-generated-unwind-info
#objdump: -drj.text
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsbindesc.dd.jj 2008-07-28 20:07:05.000000000 +0200
+++ ld/testsuite/ld-i386/tlsbindesc.dd 2011-06-20 10:10:43.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbindesc.s
#source: tlsbin.s
#as: --32
-#ld: -melf_i386 tmpdir/libtlslib.so
+#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info
#objdump: -drj.text
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsbin.dd.jj 2007-09-20 19:38:37.000000000 +0200
+++ ld/testsuite/ld-i386/tlsbin.dd 2011-06-20 10:11:10.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbinpic.s
#source: tlsbin.s
#as: --32
-#ld: -melf_i386 tmpdir/libtlslib.so
+#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info
#objdump: -drj.text
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsgdesc.rd.jj 2009-09-24 17:56:51.000000000 +0200
+++ ld/testsuite/ld-i386/tlsgdesc.rd 2011-06-20 10:09:25.000000000 +0200
@@ -1,6 +1,6 @@
#source: tlsgdesc.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --no-ld-generated-unwind-info
#readelf: -Ssrl
#target: i?86-*-*
--- ld/testsuite/ld-i386/i386.exp.jj 2011-05-03 10:09:46.000000000 +0200
+++ ld/testsuite/ld-i386/i386.exp 2011-06-20 10:20:37.000000000 +0200
@@ -118,12 +118,14 @@ if { !([istarget "i?86-*-elf*"]
# readelf: Apply readelf options on result. Compare with regex (last arg).
set i386tests {
- {"TLS -fpic -shared transitions" "-shared -melf_i386"
+ {"TLS -fpic -shared transitions"
+ "-shared -melf_i386 --no-ld-generated-unwind-info"
"--32" {tlspic1.s tlspic2.s}
{{readelf -Ssrl tlspic.rd} {objdump -drj.text tlspic.dd}
{objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
"libtlspic.so"}
- {"TLS descriptor -fpic -shared transitions" "-shared -melf_i386"
+ {"TLS descriptor -fpic -shared transitions"
+ "-shared -melf_i386 --no-ld-generated-unwind-info"
"--32" {tlsdesc.s tlspic2.s}
{{readelf -Ssrl tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
{objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}}
@@ -131,21 +133,24 @@ set i386tests {
{"Helper shared library" "-shared -melf_i386"
"--32" {tlslib.s} {} "libtlslib.so"}
{"TLS -fpic and -fno-pic exec transitions"
- "-melf_i386 tmpdir/libtlslib.so" "--32" {tlsbinpic.s tlsbin.s}
+ "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info"
+ "--32" {tlsbinpic.s tlsbin.s}
{{readelf -Ssrl tlsbin.rd} {objdump -drj.text tlsbin.dd}
{objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}}
"tlsbin"}
{"TLS descriptor -fpic and -fno-pic exec transitions"
- "-melf_i386 tmpdir/libtlslib.so" "--32" {tlsbindesc.s tlsbin.s}
+ "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info"
+ "--32" {tlsbindesc.s tlsbin.s}
{{readelf -Ssrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
{objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
"tlsbindesc"}
- {"TLS -fno-pic -shared" "-shared -melf_i386"
+ {"TLS -fno-pic -shared" "-shared -melf_i386 --no-ld-generated-unwind-info"
"--32" {tlsnopic1.s tlsnopic2.s}
{{readelf -Ssrl tlsnopic.rd} {objdump -drj.text tlsnopic.dd}
{objdump -sj.got tlsnopic.sd}} "libtlsnopic.so"}
{"TLS with global dynamic and descriptors"
- "-shared -melf_i386" "--32" {tlsgdesc.s}
+ "-shared -melf_i386 --no-ld-generated-unwind-info"
+ "--32" {tlsgdesc.s}
{{readelf -Ssrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}}
"libtlsgdesc.so"}
{"TLS in debug sections" "-melf_i386"
--- ld/testsuite/ld-i386/tlspic.sd.jj 2004-05-11 19:08:36.000000000 +0200
+++ ld/testsuite/ld-i386/tlspic.sd 2011-06-20 10:08:21.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlspic1.s
#source: tlspic2.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --no-ld-generated-unwind-info
#objdump: -sj.got
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsnopic.rd.jj 2009-09-24 17:56:51.000000000 +0200
+++ ld/testsuite/ld-i386/tlsnopic.rd 2011-06-20 10:08:55.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsnopic1.s
#source: tlsnopic2.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --no-ld-generated-unwind-info
#readelf: -Ssrl
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsbindesc.td.jj 2006-01-18 22:07:49.000000000 +0100
+++ ld/testsuite/ld-i386/tlsbindesc.td 2011-06-20 10:10:24.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbindesc.s
#source: tlsbin.s
#as: --32
-#ld: -melf_i386 tmpdir/libtlslib.so
+#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info
#objdump: -sj.tdata
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlspic.td.jj 2002-09-19 21:01:15.000000000 +0200
+++ ld/testsuite/ld-i386/tlspic.td 2011-06-20 10:08:12.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlspic1.s
#source: tlspic2.s
#as: --32
-#ld: -shared -melf_i386
+#ld: -shared -melf_i386 --no-ld-generated-unwind-info
#objdump: -sj.tdata
#target: i?86-*-*
--- ld/testsuite/ld-i386/tlsbin.sd.jj 2004-05-11 19:08:36.000000000 +0200
+++ ld/testsuite/ld-i386/tlsbin.sd 2011-06-20 10:10:56.000000000 +0200
@@ -1,7 +1,7 @@
#source: tlsbinpic.s
#source: tlsbin.s
#as: --32
-#ld: -melf_i386 tmpdir/libtlslib.so
+#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info
#objdump: -sj.got
#target: i?86-*-*
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Unwind info for PLT on i?86/x86_64
2011-06-20 9:32 ` [PATCH] Unwind info for PLT on i?86/x86_64 Jakub Jelinek
@ 2011-06-20 12:21 ` Richard Henderson
2011-06-20 13:03 ` H.J. Lu
1 sibling, 0 replies; 12+ messages in thread
From: Richard Henderson @ 2011-06-20 12:21 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: binutils, Ian Lance Taylor, Mark Wielaard, Frank Eigler
On 06/20/2011 02:31 AM, Jakub Jelinek wrote:
> On Tue, Jun 14, 2011 at 10:18:44PM +0200, Jakub Jelinek wrote:
>> Ok, here is a WIP patch which seems to work in light testing on x86_64.
>> It doesn't have yet an option to force no generation of the unwind info,
>> and some testcases (especially for TLS transitions) will either need
>> to be adjusted or get passed the new option to prevent .eh_frame for
>> .plt, as the 16 byte instead of 4 byte alignment of .plt section
>> shifted various offsets in those.
>
> And here is an updated patch, this time for both i?86 and x86-64,
> with an option to disable it (but the default being to emit
> unwind info for ld generated code sections) and testsuite adjustments.
>
> Ok for trunk?
Ok.
r~
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Unwind info for PLT on i?86/x86_64
2011-06-20 9:32 ` [PATCH] Unwind info for PLT on i?86/x86_64 Jakub Jelinek
2011-06-20 12:21 ` Richard Henderson
@ 2011-06-20 13:03 ` H.J. Lu
2011-06-20 17:14 ` H.J. Lu
1 sibling, 1 reply; 12+ messages in thread
From: H.J. Lu @ 2011-06-20 13:03 UTC (permalink / raw)
To: Jakub Jelinek
Cc: binutils, Ian Lance Taylor, Richard Henderson, Mark Wielaard,
Frank Eigler
On Mon, Jun 20, 2011 at 2:31 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Jun 14, 2011 at 10:18:44PM +0200, Jakub Jelinek wrote:
>> Ok, here is a WIP patch which seems to work in light testing on x86_64.
>> It doesn't have yet an option to force no generation of the unwind info,
>> and some testcases (especially for TLS transitions) will either need
>> to be adjusted or get passed the new option to prevent .eh_frame for
>> .plt, as the 16 byte instead of 4 byte alignment of .plt section
>> shifted various offsets in those.
>
> And here is an updated patch, this time for both i?86 and x86-64,
> with an option to disable it (but the default being to emit
> unwind info for ld generated code sections) and testsuite adjustments.
>
> Ok for trunk?
>
> 2011-06-20 Jakub Jelinek <jakub@redhat.com>
>
> include/
> * bfdlink.h (struct bfd_link_info): Add no_ld_generated_unwind_info
> option.
> ld/
> * emultempl/elf32.em (OPTION_LD_GENERATED_UNWIND_INFO,
> OPTION_NO_LD_GENERATED_UNWIND_INFO): Define.
> (gld${EMULATION_NAME}_handle_option): Handle
> --ld-generated-unwind-info and --no-ld-generated-unwind-info.
> * ld.texinfo (--ld-generated-unwind-info,
> --no-ld-generated-unwind-info): Document.
> bfd/
> * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Allow no relocations
> at all for linker created .eh_frame sections.
Please mention PR ld/12570 in ChangeLogs
http://sourceware.org/bugzilla/show_bug.cgi?id=12570
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Unwind info for PLT on i?86/x86_64
2011-06-20 13:03 ` H.J. Lu
@ 2011-06-20 17:14 ` H.J. Lu
0 siblings, 0 replies; 12+ messages in thread
From: H.J. Lu @ 2011-06-20 17:14 UTC (permalink / raw)
To: Jakub Jelinek
Cc: binutils, Ian Lance Taylor, Richard Henderson, Mark Wielaard,
Frank Eigler
On Mon, Jun 20, 2011 at 6:02 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Jun 20, 2011 at 2:31 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Tue, Jun 14, 2011 at 10:18:44PM +0200, Jakub Jelinek wrote:
>>> Ok, here is a WIP patch which seems to work in light testing on x86_64.
>>> It doesn't have yet an option to force no generation of the unwind info,
>>> and some testcases (especially for TLS transitions) will either need
>>> to be adjusted or get passed the new option to prevent .eh_frame for
>>> .plt, as the 16 byte instead of 4 byte alignment of .plt section
>>> shifted various offsets in those.
>>
>> And here is an updated patch, this time for both i?86 and x86-64,
>> with an option to disable it (but the default being to emit
>> unwind info for ld generated code sections) and testsuite adjustments.
>>
>> Ok for trunk?
>>
>> 2011-06-20 Jakub Jelinek <jakub@redhat.com>
>>
>> include/
>> * bfdlink.h (struct bfd_link_info): Add no_ld_generated_unwind_info
>> option.
>> ld/
>> * emultempl/elf32.em (OPTION_LD_GENERATED_UNWIND_INFO,
>> OPTION_NO_LD_GENERATED_UNWIND_INFO): Define.
>> (gld${EMULATION_NAME}_handle_option): Handle
>> --ld-generated-unwind-info and --no-ld-generated-unwind-info.
>> * ld.texinfo (--ld-generated-unwind-info,
>> --no-ld-generated-unwind-info): Document.
>> bfd/
>> * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Allow no relocations
>> at all for linker created .eh_frame sections.
>
> Please mention PR ld/12570 in ChangeLogs
>
> http://sourceware.org/bugzilla/show_bug.cgi?id=12570
>
> Thanks.
I checked in this patch to adjust x86 IFUNC PLT.
--
H.J.
---
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 87fd182..d764ae4 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2011-06-20 H.J. Lu <hongjiu.lu@intel.com>
+ * ld-ifunc/ifunc-1-local-x86.d: Adjusted.
+ * ld-ifunc/ifunc-1-x86.d: Likewise.
+ * ld-ifunc/ifunc-3a-x86.d: Likewise.
+
+2011-06-20 H.J. Lu <hongjiu.lu@intel.com>
+
* ld-elf/eh1.d: Revert x32 change.
* ld-elf/eh2.d: Likewise.
* ld-elf/eh3.d: Likewise.
diff --git a/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d
b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d
index 67ecdae..5408668 100644
--- a/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d
+++ b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d
@@ -3,5 +3,5 @@
#target: x86_64-*-* i?86-*-*
#...
-[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x16c|\+0x200|)@plt>
+[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x170|\+0x200|)@plt>
#pass
diff --git a/ld/testsuite/ld-ifunc/ifunc-1-x86.d
b/ld/testsuite/ld-ifunc/ifunc-1-x86.d
index 4142402..8d223db 100644
--- a/ld/testsuite/ld-ifunc/ifunc-1-x86.d
+++ b/ld/testsuite/ld-ifunc/ifunc-1-x86.d
@@ -3,5 +3,5 @@
#target: x86_64-*-* i?86-*-*
#...
-[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x184|\+0x220|)@plt>
+[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x190|\+0x220|)@plt>
#pass
diff --git a/ld/testsuite/ld-ifunc/ifunc-3a-x86.d
b/ld/testsuite/ld-ifunc/ifunc-3a-x86.d
index bcfac6f..174999d 100644
--- a/ld/testsuite/ld-ifunc/ifunc-3a-x86.d
+++ b/ld/testsuite/ld-ifunc/ifunc-3a-x86.d
@@ -4,5 +4,5 @@
#target: x86_64-*-* i?86-*-*
#...
-[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x1a8|\+0x258|)@plt>
+[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x1b0|\+0x260|)@plt>
#pass
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-06-20 17:14 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-10 7:45 RFC: Unwind info for PLT Jakub Jelinek
2011-06-10 14:11 ` Mark Kettenis
2011-06-10 14:17 ` Joseph S. Myers
2011-06-10 15:15 ` Richard Henderson
2011-06-13 17:14 ` Jakub Jelinek
2011-06-13 17:34 ` Richard Henderson
2011-06-13 20:53 ` Ian Lance Taylor
2011-06-14 20:19 ` Jakub Jelinek
2011-06-20 9:32 ` [PATCH] Unwind info for PLT on i?86/x86_64 Jakub Jelinek
2011-06-20 12:21 ` Richard Henderson
2011-06-20 13:03 ` H.J. Lu
2011-06-20 17:14 ` H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).