https://sourceware.org/bugzilla/show_bug.cgi?id=23837
Bug ID: 23837 Summary: Segmentation fault in resolve_symbol_value at symbols.c:1165 Product: binutils Version: 2.31 Status: NEW Severity: normal Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: danglin at gcc dot gnu.org Target Milestone: --- Host: hppa-unknown-linux-gnu Target: hppa-unknown-linux-gnu Build: hppa-unknown-linux-gnu Created attachment 11370 --> https://sourceware.org/bugzilla/attachment.cgi?id=11370&action=edit .s file Assembly of gbc.c from gcl-2.6.12 fails with a segmentation fault. Attached assembly source. The fault occurs here: (gdb) r Starting program: /home/dave/opt/gnu/bin/as -o gbc.o gbc.s Program received signal SIGSEGV, Segmentation fault. 0x00034bac in resolve_symbol_value (symp=0x6f668) at ../../src/gas/symbols.c:1165 1165 final_val += symp->sy_frag->fr_address / OCTETS_PER_BYTE; (gdb) bt #0 0x00034bac in resolve_symbol_value (symp=0x6f668) at ../../src/gas/symbols.c:1165 #1 0x0003b710 in write_object_file () at ../../src/gas/write.c:2266 #2 0x00013104 in main (argc=<optimized out>, argv=<optimized out>) at ../../src/gas/as.c:1385 (gdb) p *symp $1 = {sy_flags = {sy_local_symbol = 0, sy_written = 0, sy_resolved = 0, sy_resolving = 1, sy_used_in_reloc = 0, sy_used = 0, sy_volatile = 0, sy_forward_ref = 0, sy_mri_common = 0, sy_weakrefr = 0, sy_weakrefd = 0}, bsym = 0x8c8c8, sy_value = {X_add_symbol = 0x0, X_op_symbol = 0x0, X_add_number = 0, X_op = O_constant, X_unsigned = 0, X_extrabit = 0, X_md = 0}, sy_next = 0x6f760, sy_previous = 0x6f620, sy_frag = 0x655f7265, sy_obj = {local = 0, size = 0x0, versioned_name = 0x0}} It appears the value at symp->sy_frag is set in brk: (gdb) watch *0x6f688 Watchpoint 2: *0x6f688 (gdb) c Continuing. Watchpoint 2: *0x6f688 Old value = <unreadable> New value = 0 0xf80d7ad0 in brk () from /lib/hppa-linux-gnu/libc.so.6 (gdb) c Continuing. Watchpoint 2: *0x6f688 Old value = 0 New value = 1700754021 0xf80d7ad0 in brk () from /lib/hppa-linux-gnu/libc.so.6 (gdb) p/x *0x6f688 $6 = 0x655f7265 (gdb) bt #0 0xf80d7ad0 in brk () from /lib/hppa-linux-gnu/libc.so.6 #1 0xf80d7c20 in sbrk () from /lib/hppa-linux-gnu/libc.so.6 #2 0xf80718c4 in __default_morecore () from /lib/hppa-linux-gnu/libc.so.6 #3 0xf806d0e0 in ?? () from /lib/hppa-linux-gnu/libc.so.6 #4 0xf806e210 in ?? () from /lib/hppa-linux-gnu/libc.so.6 #5 0xf806f7cc in malloc () from /lib/hppa-linux-gnu/libc.so.6 #6 0xf8594b3c in _objalloc_alloc (o=0x21000 <frag_variant+100>, original_len=<optimized out>) at ../../src/libiberty/objalloc.c:159 #7 0xf8523bc0 in bfd_alloc (abfd=<optimized out>, size=<optimized out>) at ../../src/bfd/opncls.c:950 #8 0xf85241e4 in bfd_zalloc (abfd=<optimized out>, size=716800) at ../../src/bfd/opncls.c:998 #9 0xf854ab10 in _bfd_elf_make_empty_symbol (abfd=0xaf000) at ../../src/bfd/elf.c:8691 #10 0x00034548 in symbol_create (name=<optimized out>, segment=0xae590, valu=4162225112, frag=0x21000 <frag_variant+100>) at ../../src/gas/symbols.c:147 #11 0x0003463c in symbol_new (name=<optimized out>, segment=<optimized out>, valu=<optimized out>, frag=<optimized out>) at ../../src/gas/symbols.c:89 #12 0x000360c4 in symbol_find_or_make (name=0xaf000 "") at ../../src/gas/symbols.c:532 #13 0x0001f4ac in operand (expressionP=0xf8165c80, mode=(unknown: 4162225112)) at ../../src/gas/expr.c:1305 ---Type <return> to continue, or q <return> to quit--- #14 0x0001f9a4 in expr (rankarg=<optimized out>, resultP=0x1008, mode=(unknown: 135168)) at ../../src/gas/expr.c:1765 #15 0x00040cb8 in parse_cons_expression_hppa (exp=0xf8165c80) at ../../src/gas/config/tc-hppa.c:2490 #16 0x0002d530 in cons_worker (nbytes=135168, rva=2672) at ../../src/gas/read.c:4004 #17 0x0003e338 in pa_cons (nbytes=<optimized out>) at ../../src/gas/config/tc-hppa.c:8160 #18 0x000303ac in read_a_source_file (name=<optimized out>) at ../../src/gas/read.c:1148 #19 0x00012ec8 in perform_an_assembly_pass (argv=<optimized out>, argc=-133469057) at ../../src/gas/as.c:1192 #20 main (argc=<optimized out>, argv=<optimized out>) at ../../src/gas/as.c:1349 (gdb) disass $pc-32,$pc+32 Dump of assembler code from 0xf80d7ab0 to 0xf80d7af0: 0xf80d7ab0 <nice+260>: ldw,mb -80(sp),r7 0xf80d7ab4 <brk+0>: stw rp,-14(sp) 0xf80d7ab8 <brk+4>: stw,ma r4,40(sp) 0xf80d7abc <brk+8>: stw r3,-3c(sp) 0xf80d7ac0 <brk+12>: stw r19,-20(sp) 0xf80d7ac4 <brk+16>: copy r19,r4 0xf80d7ac8 <brk+20>: be,l 100(sr2,r0),sr0,r31 0xf80d7acc <brk+24>: ldi 2d,r20 => 0xf80d7ad0 <brk+28>: copy r4,r19 0xf80d7ad4 <brk+32>: ldi ffd,r20 0xf80d7ad8 <brk+36>: ldo ffe(ret0),r21 0xf80d7adc <brk+40>: cmpb,>>= r20,r21,0xf80d7b08 <brk+84> 0xf80d7ae0 <brk+44>: addil L%1000,r19,r1 0xf80d7ae4 <brk+48>: ldw 764(r1),r20 0xf80d7ae8 <brk+52>: stw ret0,0(r20) 0xf80d7aec <brk+56>: cmpb,<< ret0,r26,0xf80d7b48 <brk+148> End of assembler dump. (gdb) c Continuing. Program received signal SIGSEGV, Segmentation fault. 0x00034bac in resolve_symbol_value (symp=0x6f668) at ../../src/gas/symbols.c:1165 1165 final_val += symp->sy_frag->fr_address / OCTETS_PER_BYTE; -- 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