[PATCH] fix ld segv on alpha during gal compilation

Julien LEMOINE speedblue@debian.org
Fri Apr 18 23:34:00 GMT 2003


This patch patch fix ld segv during libgal compilation.
Full bug report is available at : 
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=185556).

Patch and backtrace are attached with this mail.

Best Regards.
-- 
Julien LEMOINE / SpeedBlue
-------------- next part --------------
--- binutils-2.13.90.0.18/bfd/elf64-alpha.c	2003-01-21 19:21:32.000000000 +0100
+++ binutils-2.13.90.0.18-modif/bfd/elf64-alpha.c	2003-04-11 01:24:26.000000000 +0200
@@ -4184,9 +4184,12 @@
 
   loc = srel->contents;
   loc += srel->reloc_count++ * sizeof (Elf64_External_Rela);
-  bfd_elf64_swap_reloca_out (abfd, &outrel, loc);
-  BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
-	      <= srel->_cooked_size);
+  if (loc)
+    {
+      bfd_elf64_swap_reloca_out (abfd, &outrel, loc);
+      BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
+		  <= srel->_cooked_size);
+    }
 }
 
 /* Relocate an Alpha ELF section for a relocatable link.
-------------- next part --------------
Program received signal SIGSEGV, Segmentation fault.
0x00000200000a1100 in bfd_putl64 (data=4406113, addr=0x0) at ../../bfd/libbfd.c:684
684       addr[7] = (bfd_byte) (data >> (7*8));
(gdb) bt full
#0  0x00000200000a1100 in bfd_putl64 (data=4406113, addr=0x0) at ../../bfd/libbfd.c:684
No locals.
#1  0x00000200000cf69c in bfd_elf64_swap_reloca_out (abfd=0x1201c7e40, src=0x11fffe940, d=0x0) at ../../bfd/elfcode.h:467
        dst = (Elf64_External_Rela *) 0x0
#2  0x00000200000cafd4 in elf64_alpha_emit_dynrel (abfd=0x1201c7e40, info=0x1201baab8, sec=0x121675898, srel=0x1201d7128, offset=14545,
    dynindx=855, rtype=2, addend=0) at ../../bfd/elf64-alpha.c:4187
        outrel = {r_offset = 4406113, r_info = 3672197038082, r_addend = 0}
        loc = (bfd_byte *) 0x0
#3  0x00000200000cc354 in elf64_alpha_relocate_section (output_bfd=0x1201c7e40, info=0x1201baab8, input_bfd=0x121673330,
    input_section=0x121675898, contents=0x12197be70 "\0029", relocs=0x121684550, local_syms=0x121995fd0, local_sections=0x121996fb0)
    at ../../bfd/elf64-alpha.c:4685
        dynindx = 855
        dyntype = 2
        dynaddend = 0
        howto = (const struct reloc_howto_struct *) 0x200002a8630
        sym = (Elf_Internal_Sym *) 0x0
        sec = (asection *) 0x121675568
        value = 0
        undef_weak_ref = 0
        h = (struct alpha_elf_link_hash_entry *) 0x120351ac0
        gotent = (struct alpha_elf_got_entry *) 0x0
        r = bfd_reloc_ok
        r_symndx = 19
        addend = 0
        dynamic_symbol_p = 1
        r_type = 2
        symtab_hdr = (Elf_Internal_Shdr *) 0x12167f920
        rel = (Elf_Internal_Rela *) 0x12168af28
        relend = (Elf_Internal_Rela *) 0x12168afa0
        tls_segment = (struct elf_link_tls_segment *) 0x0
        sgot = (asection *) 0x1201d7018
        srel = (asection *) 0x1201d7128
        srelgot = (asection *) 0x120d95cd8
        dynobj = (bfd *) 0x1201d4210
        gotobj = (bfd *) 0x1201d4210
        gp = 4833017040
        tp_base = 0
        dtp_base = 0
        local_got_entries = (struct alpha_elf_got_entry **) 0x0
        ret_val = 1
        section_name = 0x12167427f ".rela.debug_info"
#4  0x00000200000e18a8 in elf_link_input_bfd (finfo=0x11fffecd0, input_bfd=0x121673330) at ../../bfd/elflink.h:6791
        internal_relocs = (Elf_Internal_Rela *) 0x121684550
        contents = (bfd_byte *) 0x12197be70 "\0029"
        relocate_section = (bfd_boolean (*)(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *,
---Type <return> to continue, or q <return> to quit---
   Elf_Internal_Sym *, asection **)) 0x200000cb240 <elf64_alpha_relocate_section>
        output_bfd = (bfd *) 0x1201c7e40
        symtab_hdr = (Elf_Internal_Shdr *) 0x12167f920
        locsymcount = 19
        extsymoff = 19
        isymbuf = (Elf_Internal_Sym *) 0x121995fd0
        isym = (Elf_Internal_Sym *) 0x121996230
        isymend = (Elf_Internal_Sym *) 0x121996230
        pindex = (long int *) 0x121996d18
        ppsection = (asection **) 0x121997048
        o = (asection *) 0x121675898
        bed = (struct elf_backend_data *) 0x200002a9460
        emit_relocs = 0
        sym_hashes = (struct elf_link_hash_entry **) 0x12167fda0
#5  0x00000200000dd9f4 in bfd_elf64_bfd_final_link (abfd=0x1201c7e40, info=0x1201baab8) at ../../bfd/elflink.h:5300
        dynamic = 1
        emit_relocs = 0
        dynobj = (bfd *) 0x1201d4210
        finfo = {info = 0x1201baab8, output_bfd = 0x1201c7e40, symstrtab = 0x1201eceb0, dynsym_sec = 0x1201d7788,
  hash_sec = 0x120d959a8, symver_sec = 0x1201d7568, first_tls_sec = 0x0, contents = 0x12197be70 "\0029",
  external_relocs = 0x200005f0010, internal_relocs = 0x20000618010, external_syms = 0x121995650, locsym_shndx = 0x0,
  internal_syms = 0x121995fd0, indices = 0x121996c80, sections = 0x121996fb0, symbuf = 0x12197b4f0, symshndxbuf = 0x0,
  symbuf_count = 89, symbuf_size = 101, shndxbuf_size = 0}
        o = (asection *) 0x121926ff8
        p = (struct bfd_link_order *) 0x121959a40
        sub = (bfd *) 0x121673330
        max_contents_size = 104393
        max_external_reloc_size = 162552
        max_internal_reloc_count = 6773
        max_sym_count = 101
        max_sym_shndx_count = 0
        off = 6251312
        elfsym = {st_value = 0, st_size = 0, st_name = 0, st_info = 3 '\003', st_other = 0 '\0', st_shndx = 36}
        i = 37
        symtab_hdr = (Elf_Internal_Shdr *) 0x1201c8020
        symtab_shndx_hdr = (Elf_Internal_Shdr *) 0x0
        symstrtab_hdr = (Elf_Internal_Shdr *) 0x1201bad00
        bed = (struct elf_backend_data *) 0x200002a9460
        eoinfo = {failed = 538684672, localsyms = 1, finfo = 0x20000383aa0}
        merged = 1
        relativecount = 0
        reldyn = (asection *) 0x0
        amt = 808
#6  0x00000200000cdf3c in elf64_alpha_final_link (abfd=0x1201c7e40, info=0x1201baab8) at ../../bfd/elf64-alpha.c:5366
        o = (asection *) 0x0
---Type <return> to continue, or q <return> to quit---
        p = (struct bfd_link_order *) 0x3f
        mdebug_sec = (asection *) 0x0
        debug = {symbolic_header = {magic = -21104, vstamp = 8193, ilineMax = 4831834016, cbLine = 2199023453408,
    cbLineOffset = 2199023425528, idnMax = 2199023292840, cbDnOffset = 2199023423864, ipdMax = 4831834384, cbPdOffset = 1,
    isymMax = 2199023423040, cbSymOffset = 2199023423856, ioptMax = 0, cbOptOffset = 4831834120, iauxMax = 4831849982,
    cbAuxOffset = 43446978, issMax = 4831847472, cbSsOffset = 4831834216, issExtMax = 1, cbSsExtOffset = 2199023309744,
    ifdMax = 4833641620, cbFdOffset = 4831835000, crfd = 4831855952, cbRfdOffset = 4831834448, iextMax = 0,
    cbExtOffset = 2199027021888}, line = 0x20000476d68 "", external_dnr = 0x20000476d68, external_pdr = 0xfe0, external_sym = 0x3f,
  external_opt = 0x20000475a58, external_aux = 0x20000397840, ss = 0x20000476d68 "", ssext = 0x20000476d68 "", external_fdr = 0xfe0,
  external_rfd = 0x3f, external_ext = 0x20000475a58, ssext_end = 0x12001ad90 "\032", external_ext_end = 0x20000475a58,
  ifdmap = 0x20000271308, fdr = 0x1201b8494, adjust = 0x11ffff378}
        swap = (const struct ecoff_debug_swap *) 0x200002a92f0
        symhdr = (HDRR *) 0x11fffef28
        mdebug_handle = (void *) 0x0
#7  0x000000012001f4d8 in ldwrite () at ../../ld/ldwrite.c:540
No locals.
#8  0x000000012001b938 in main (argc=63, argv=0x11ffff378) at ../../ld/ldmain.c:448
        emulation = 0x11ffff781 "elf64alpha"
        start_time = 30273


More information about the Binutils mailing list