https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60465

--- Comment #25 from Mike Frysinger <vapier at gentoo dot org> ---
here's the series of link commands:
gcc -nostdlib -nostartfiles -r -o elf/librtld.os \
  '-Wl,-(' /home/vapier/glibc/build/elf/dl-allobjs.os elf/rtld-libc.a -lgcc \
  '-Wl,-)' -Wl,-Map,elf/librtld.os.map
gcc -nostdlib -nostartfiles -shared -o elf/ld.so \
  -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,defs \
  elf/librtld.os -Wl,--version-script=./ld.map \
      -Wl,-soname=ld-linux-ia64.so.2 \
      -Wl,-defsym=_begin=0

in my disassembly it's using r24 & r22, but i'm guessing that doesn't matter
terribly much:
$ gdb --args ./elf/ld.so --library-path $PWD ./a.out 
Reading symbols from /home/vapier/glibc/build/elf/ld.so...done.
(gdb) b *_dl_start+304
Breakpoint 1 at 0xabb0: file get-dynamic-info.h, line 61.
(gdb) display /i $pc
(gdb) display $r24
(gdb) display $r22
(gdb) r
Starting program: /home/vapier/glibc/build/./elf/ld.so --library-path
/home/vapier/glibc/build ./a.out

Breakpoint 1, elf_get_dynamic_info (temp=0x0, l=0x20000008000510c8
<_rtld_local+2456>) at get-dynamic-info.h:61
61                   + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM] = dyn;
3: $r22 = 0x20000008000505d8
2: $r24 = 0x20000008000505d8
1: x/i $pc
=> 0x200000080000abb0 <_dl_start+304>:  [MMI]       ld8 r24=[r24]
(gdb) stepi
58                   + DT_VERSIONTAGNUM + DT_EXTRANUM] = dyn;
3: $r22 = 0x20000008000505d8
2: $r24 = 0x380050730
1: x/i $pc
=> 0x200000080000abb1 <_dl_start+305>:              ld8 r22=[r22]
(gdb) stepi
61                   + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM] = dyn;
3: $r22 = 0x380050730
2: $r24 = 0x380050730
1: x/i $pc
=> 0x200000080000abb2 <_dl_start+306>:              nop.i 0x0;;
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x200000080000b5f1 in elf_get_dynamic_info (temp=0x0, l=0x20000008000510c8
<_rtld_local+2456>) at get-dynamic-info.h:61
61                   + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM] = dyn;
3: $r22 = 0x3800502b0
2: $r24 = 0x380050b10
1: x/i $pc
=> 0x200000080000b5f1 <_dl_start+2929>:       (p07) st8 [r14]=r15
(gdb)

Reply via email to