https://sourceware.org/bugzilla/show_bug.cgi?id=22537

            Bug ID: 22537
           Summary: Segmentation fault with static PIE
           Product: binutils
           Version: 2.30 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---
            Target: hppa-linux

On hjl/pie/static branch in glibc git repo, when --enable-static-pie
is used to configure glibc, I got

(gdb) r
--sysroot=/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../sysroot
-static -o
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/elf/sln
-L/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../lib/gcc/hppa-glibc-linux-gnu/7.2.1
-L/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../lib/gcc
-L/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../lib/gcc/hppa-glibc-linux-gnu/7.2.1/../../../../hppa-glibc-linux-gnu/lib
-L/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../sysroot/lib
-L/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../sysroot/usr/lib
-pie --no-dynamic-linker --eh-frame-hdr -z text
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/csu/rcrt1.o
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/csu/crti.o
/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../lib/gcc/hppa-glibc-linux-gnu/7.2.1/crtbeginS.o
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/elf/sln.o
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/elf/static-stubs.o
--start-group
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/libc.a -lgcc
--end-group
/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../lib/gcc/hppa-glibc-linux-gnu/7.2.1/crtendS.o
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/csu/crtn.o
Starting program:
/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/hppa-glibc-linux-gnu-ld
--sysroot=/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../sysroot
-static -o
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/elf/sln
-L/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../lib/gcc/hppa-glibc-linux-gnu/7.2.1
-L/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../lib/gcc
-L/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../lib/gcc/hppa-glibc-linux-gnu/7.2.1/../../../../hppa-glibc-linux-gnu/lib
-L/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../sysroot/lib
-L/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../sysroot/usr/lib
-pie --no-dynamic-linker --eh-frame-hdr -z text
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/csu/rcrt1.o
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/csu/crti.o
/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../lib/gcc/hppa-glibc-linux-gnu/7.2.1/crtbeginS.o
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/elf/sln.o
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/elf/static-stubs.o
--start-group
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/libc.a -lgcc
--end-group
/export/ssd/git/toolchain/install/compilers/hppa-linux-gnu/bin/../lib/gcc/hppa-glibc-linux-gnu/7.2.1/crtendS.o
/export/gnu/import/git/toolchain/build/glibcs/hppa-linux-gnu/glibc/csu/crtn.o
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.26-18.0.fc27.x86_64

Program received signal SIGSEGV, Segmentation fault.
hppa_build_one_stub (bh=0x73e310, in_arg=<optimized out>)
---Type <return> to continue, or q <return> to quit---
    at /export/gnu/import/git/toolchain/src/binutils/bfd/elf32-hppa.c:759
759           sym_value -= (hsh->stub_offset
(gdb) p hsh
$1 = (struct elf32_hppa_stub_hash_entry *) 0x73e310
(gdb) list
754           sym_value = (hsh->target_value
755                        + hsh->target_section->output_offset
756                        + hsh->target_section->output_section->vma);
757     
758           /* And this is where we are coming from, more or less.  */
759           sym_value -= (hsh->stub_offset
760                         + stub_sec->output_offset
761                         + stub_sec->output_section->vma);
762     
763           bfd_put_32 (stub_bfd, (bfd_vma) BL_R1, loc);
(gdb) p hsh->target_section
$2 = (asection *) 0x0
(gdb) bt
#0  hppa_build_one_stub (bh=0x73e310, in_arg=<optimized out>)
    at /export/gnu/import/git/toolchain/src/binutils/bfd/elf32-hppa.c:759
#1  0x000000000042c7d0 in bfd_hash_traverse (table=table@entry=0x734a28, 
    func=func@entry=0x43e690 <hppa_build_one_stub>, 
    info=info@entry=0x719c80 <link_info>)
    at /export/gnu/import/git/toolchain/src/binutils/bfd/hash.c:656
#2  0x000000000043ff95 in elf32_hppa_build_stubs (info=0x719c80 <link_info>)
    at /export/gnu/import/git/toolchain/src/binutils/bfd/elf32-hppa.c:3120
#3  0x00000000004225bb in gldhppalinux_after_allocation () at ehppalinux.c:386
#4  0x0000000000414f81 in lang_process ()
    at /export/gnu/import/git/toolchain/src/binutils/ld/ldlang.c:7393
#5  0x00000000004033ee in main (argc=<optimized out>, argv=<optimized out>)
    at /export/gnu/import/git/toolchain/src/binutils/ld/ldmain.c:432
(gdb)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to