This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
The mips64-elf toolchain is creating .rel.dyn sections, even though it does not support dynamic linking, and does not create dynamic sections. I attached a testcase. Both old and new binutils call mips_elf_rel_dyn_section to create the .rel.dyn section when a R_MIPS_32 reloc is seen, in case it is needed. In old binutils, this gets removed as a zero-size section in _bfd_mips_elf_size_dynamic_sections. In new binutils, we call allocate_dynrelocs first, which creates dummy relocs in the .rel.dyn section, and now it can't be removed as it is no longer a zero size section. The bug seems to be in allocate_dynrelocs in elfxx-mips.c, which does if (! info->relocatable && hmips->possibly_dynamic_relocs != 0 && (h->root.type == bfd_link_hash_defweak || !h->def_regular || info->shared)) However, we are looking at a reference here, not a definition, so none of the h->def_* bits are set, though we do have h->ref_* bits set. Breakpoint 2, allocate_dynrelocs (h=0x817c8ec, inf=0x81692e0) at ../../new-combined/bfd/elfxx-mips.c:8551 (gdb) print *h $1 = {root = {root = {next = 0x817c574, string = 0x8198b86 "i", hash = 13803625\ }, type = bfd_link_hash_defined, non_ir_ref = 0, u = {undef = {next = 0x0, abfd\ = 0x8193a54}, def = {next = 0x0, section = 0x8193a54, value = 0}, i = {next = \ 0x0, link = 0x8193a54, warning = 0x0}, c = {next = 0x0, p = 0x8193a54, size = 0\ }}}, indx = -1, dynindx = -1, got = {refcount = -1, offset = 184467440737095516\ 15, glist = 0xffffffff, plist = 0xffffffff}, plt = {refcount = -1, offset = 184\ 46744073709551615, glist = 0xffffffff, plist = 0xffffffff}, size = 4, type = 1,\ other = 0, target_internal = 0, ref_regular = 1, def_regular = 0, ref_dynamic \ = 0, def_dynamic = 0, ref_regular_nonweak = 1, dynamic_adjusted = 0, needs_copy\ = 0, needs_plt = 0, non_elf = 0, hidden = 0, forced_local = 0, dynamic = 0, ma\ rk = 0, non_got_ref = 0, dynamic_def = 0, dynamic_weak = 0, pointer_equality_ne\ eded = 0, unique_global = 0, dynstr_index = 0, u = {weakdef = 0x0, elf_hash_val\ ue = 0}, verinfo = {verdef = 0x0, vertree = 0x0}, vtable = 0x0} (gdb) This suggests that maybe the line || !h->def_regular Should instead be || (!h->def_regular && !h->ref_regular) I am not sure if the h->ref_regular_nonweak bit needs to be tested also or instead of ref_regular. I don't have any mips-linux system using PLTs and copy-relocs yet, so I don't have an easy way to test that. I also don't have a binutils assignment yet, so I can't formally contribute a patch for this. I can open a bugzilla bug report if necessary. Jim
Attachment:
mips64-elf-rel-dyn.txt
Description: mips64-elf-rel-dyn.txt
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |