[Bug 237068] /usr/local/bin/ld: BFD (GNU Binutils) 2.30 assertion fail elflink.c:2824

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun May 19 19:43:47 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237068

Mark Millard <marklmi26-fbsd at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marklmi26-fbsd at yahoo.com

--- Comment #8 from Mark Millard <marklmi26-fbsd at yahoo.com> ---
I see this sort of thing on powerpc64 with 2.32 as well.

The code reporting the problem is the last BFD_ASSERT
in:

static bfd_boolean
_bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
                          struct elf_info_failed *eif)
{
. . .
 if (h->is_weakalias)
   {
     struct elf_link_hash_entry *def = weakdef (h);

     /* If the real definition is defined by a regular object file,
        don't do anything special.  See the longer description in
        _bfd_elf_adjust_dynamic_symbol, below.  */
     if (def->def_regular)
       {
         h = def;
         while ((h = h->u.alias) != def)
           h->is_weakalias = 0;
       }
     else
       {
         while (h->root.type == bfd_link_hash_indirect)
           h = (struct elf_link_hash_entry *) h->root.u.i.link;
         BFD_ASSERT (h->root.type == bfd_link_hash_defined
                     || h->root.type == bfd_link_hash_defweak);
         BFD_ASSERT (def->def_dynamic);
         BFD_ASSERT (def->root.type == bfd_link_hash_defined);
         (*bed->elf_backend_copy_indirect_symbol) (eif->info, def, h);
       }
   }

 return TRUE;
}

For:

/usr/bin/powerpc64-unknown-freebsd13.0-ld "--eh-frame-hdr" "-Bshareable"
"--enable-new-dtags" "-o" "lib/libLTO.so.6.0.1" "/usr/lib/crti.o"
"/usr/lib/crtbeginS.o" "-L/usr/local/lib" "-L/usr/lib" "-z" "origin" "-O3"
"--gc-sections" "--version-script"
"/wrkdirs/usr/ports/devel/llvm60/work/.build/tools/lto/LTO.exports" "-soname"
"libLTO.so.6" "tools/lto/CMakeFiles/LTO.dir/LTODisassembler.cpp.o"
"tools/lto/CMakeFiles/LTO.dir/lto.cpp.o" "-rpath"
"\$ORIGIN/../lib:/usr/local/lib" "lib/libLLVM-6.0.so" "-lc++" "-lm" "-lgcc"
"--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s"
"--no-as-needed" "/usr/lib/crtendS.o" "/usr/lib/crtn.o"

the backtrace at the first message report is:

Breakpoint 1, error_handler_internal (fmt=0x101dbc48 "BFD %s assertion fail
%s:%d", ap=0x3fffffffffffcdc8 "") at bfd.c:1093
1093    {
(gdb) bt
#0  error_handler_internal (fmt=0x101dbc48 "BFD %s assertion fail %s:%d",
ap=0x3fffffffffffcdc8 "") at bfd.c:1093
#1  0x00000000100204e8 in ld_bfd_error_handler (fmt=<optimized out>,
ap=<optimized out>) at ./ldmain.c:187
#2  0x0000000010049b7c in _bfd_error_handler (fmt=<optimized out>) at
bfd.c:1178
#3  0x000000001002047c in ld_bfd_assert_handler (fmt=<optimized out>,
bfdver=<optimized out>, file=<optimized out>, line=<optimized out>) at
./ldmain.c:177
#4  0x0000000010049de4 in bfd_assert (file=<optimized out>, line=<optimized
out>) at bfd.c:1429
#5  0x00000000100a520c in _bfd_elf_fix_symbol_flags (h=h at entry=0x811e77b70,
eif=eif at entry=0x3fffffffffffcf70) at elflink.c:2935
#6  0x00000000100a54a0 in _bfd_elf_link_assign_sym_version (h=0x811e77b70,
data=0x3fffffffffffd148) at elflink.c:2363
#7  0x0000000010053d28 in bfd_link_hash_traverse (htab=0x810e50000,
func=@0x10223720: 0x100a5460 <_bfd_elf_link_assign_sym_version>,
info=<optimized out>) at linker.c:669
#8  0x00000000100ab92c in bfd_elf_size_dynamic_sections
(output_bfd=0x810e4b000, soname=0x3fffffffffffdc87 "libLTO.so.6",
rpath=0x8105fee80 "$ORIGIN/../lib:/usr/local/lib", filter_shlib=0x0, 
    audit=0x0, depaudit=0x0, auxiliary_filters=0x0, info=0x102324d8
<link_info>, sinterpptr=0x3fffffffffffd280) at elflink.c:6316
#9  0x0000000010032b34 in gldelf64ppc_fbsd_before_allocation () at
eelf64ppc_fbsd.c:2107
#10 ppc_before_allocation () at eelf64ppc_fbsd.c:404
#11 0x00000000100264e0 in ldemul_before_allocation () at ldemul.c:82
#12 0x000000001001d644 in lang_process () at ldlang.c:7593
#13 0x00000000100047b8 in main (argc=<optimized out>, argv=<optimized out>) at
./ldmain.c:440


For _bfd_elf_fix_symbol_flags the later gdb output shows that *h has:

_ZZN4llvm7hashing6detail18get_execution_seedEvE4seed@@LLVM_6.0
root.type = bfd_link_hash_defweak
is_weakalias = 1

*h->u.alias has:
__bss_start@@LLVM_6.0
root.type = bfd_link_hash_indirect
is_weakalias = 0

So that was def (via weakdef) and def->root.type==bfd_link_hash_indirect .

(Not that I know what to do next with such information.)

The supporting details:

static inline struct elf_link_hash_entry *
weakdef (struct elf_link_hash_entry *h)
{
  while (h->is_weakalias)
    h = h->u.alias;
  return h;
}

(gdb) down
#5  0x00000000100a520c in _bfd_elf_fix_symbol_flags (h=h at entry=0x811e77b70,
eif=eif at entry=0x3fffffffffffcf70) at elflink.c:2935
2935              BFD_ASSERT (def->root.type == bfd_link_hash_defined);

(gdb) print def
$1 = <optimized out>

(gdb) print *h
$5 = {root = {root = {next = 0x0, string = 0x811e77b30
"_ZZN4llvm7hashing6detail18get_execution_seedEvE4seed@@LLVM_6.0", hash =
1230121370}, type = bfd_link_hash_defweak, non_ir_ref_regular = 0, 
    non_ir_ref_dynamic = 0, linker_def = 0, ldscript_def = 0, rel_from_abs = 0,
u = {undef = {next = 0x0, abfd = 0x811072340}, def = {next = 0x0, section =
0x811072340, value = 0}, i = {next = 0x0, 
        link = 0x811072340, warning = 0x0}, c = {next = 0x0, p = 0x811072340,
size = 0}}}, indx = -1, dynindx = -1, got = {refcount = 0, offset = 0, glist =
0x0, plist = 0x0}, plt = {refcount = 0, 
    offset = 0, glist = 0x0, plist = 0x0}, size = 8, type = 1, other = 0,
target_internal = 0, ref_regular = 0, def_regular = 0, ref_dynamic = 0,
def_dynamic = 1, ref_regular_nonweak = 0, 
  dynamic_adjusted = 0, needs_copy = 0, needs_plt = 0, non_elf = 0, versioned =
versioned, forced_local = 0, dynamic = 0, mark = 0, non_got_ref = 0,
dynamic_def = 1, ref_dynamic_nonweak = 0, 
  pointer_equality_needed = 0, unique_global = 0, protected_def = 0, start_stop
= 0, is_weakalias = 1, dynstr_index = 0, u = {alias = 0x8119bc690,
elf_hash_value = 34655159952}, verinfo = {
    verdef = 0x811073448, vertree = 0x811073448}, u2 = {start_stop_section =
0x0, vtable = 0x0}}

(gdb) print *(eif->info)
$7 = {type = type_dll, symbolic = 0, nocopyreloc = 0, export_dynamic = 0,
create_default_symver = 0, gc_sections = 1, gc_keep_exported = 0, notice_all =
0, lto_plugin_active = 0, 
  strip_discarded = 1, dynamic_data = 0, resolve_section_groups = 1, strip =
strip_none, discard = discard_sec_merge, elf_stt_common = unchanged,
common_skip_ar_symbols = bfd_link_common_skip_none, 
  unresolved_syms_in_objects = RM_IGNORE, unresolved_syms_in_shared_libs =
RM_IGNORE, static_link = 0, keep_memory = 1, emitrelocations = 0, relro = 0,
separate_code = 0, eh_frame_hdr_type = 1, 
  warn_shared_textrel = 0, error_textrel = 0, emit_hash = 1, emit_gnu_hash = 0,
reduce_memory_overheads = 0, traditional_format = 0, combreloc = 1,
default_imported_symver = 0, new_dtags = 1, 
  no_ld_generated_unwind_info = 0, task_link = 0, allow_multiple_definition =
0, prohibit_multiple_definition_absolute = 0, allow_undefined_version = 1,
dynamic = 0, execstack = 0, noexecstack = 0, 
  optimize = 1, print_gc_sections = 0, warn_alternate_em = 0, user_phdrs = 0,
load_phdrs = 1, check_relocs_after_open_input = 1, bndplt = 0, ibtplt = 0, ibt
= 0, shstk = 0, nointerp = 0, 
  no_reloc_overflow_check = 0, call_nop_as_suffix = 0,
inhibit_common_definition = 0, has_map_file = 0, call_nop_byte = 0 '\000',
wrap_char = 46 '.', path_separator = 58 ':', 
  compress_debug = COMPRESS_DEBUG_NONE, stacksize = 0,
disable_target_specific_optimizations = -1, callbacks = 0x10229318
<link_callbacks>, hash = 0x810e50000, keep_hash = 0x0, notice_hash = 0x0, 
  wrap_hash = 0x0, ignore_hash = 0x0, output_bfd = 0x810e4b000, out_implib_bfd
= 0x0, input_bfds = 0x810e4b140, input_bfds_tail = 0x810e4cc70,
create_object_symbols_section = 0x0, 
  gc_sym_list = 0x810e491a0, base_file = 0x0, init_function = 0x10143078
"_init", fini_function = 0x10143080 "_fini", relax_pass = 1, relax_trip = 0,
extern_protected_data = -1, 
  dynamic_undefined_weak = -1, pei386_auto_import = -1,
pei386_runtime_pseudo_reloc = 0, spare_dynamic_tags = 5, flags = 1, flags_1 =
128, relro_start = 0, relro_end = 0, dynamic_list = 0x0, 
  version_info = 0x810e22000}

(gdb) print *h->u.alias
$8 = {root = {root = {next = 0x8128f5e28, string = 0x8119bc678
"__bss_start@@LLVM_6.0", hash = 266808839}, type = bfd_link_hash_indirect,
non_ir_ref_regular = 0, non_ir_ref_dynamic = 0, 
    linker_def = 0, ldscript_def = 1, rel_from_abs = 1, u = {undef = {next =
0x8119bc690, abfd = 0x8119bc748}, def = {next = 0x8119bc690, section =
0x8119bc748, value = 158833}, i = {
        next = 0x8119bc690, link = 0x8119bc748, warning = 0x26c71 <error:
Cannot access memory at address 0x26c71>}, c = {next = 0x8119bc690, p =
0x8119bc748, size = 158833}}}, indx = -1, 
  dynindx = -1, got = {refcount = 0, offset = 0, glist = 0x0, plist = 0x0}, plt
= {refcount = 0, offset = 0, glist = 0x0, plist = 0x0}, size = 0, type = 0,
other = 0, target_internal = 0, 
  ref_regular = 0, def_regular = 0, ref_dynamic = 1, def_dynamic = 1,
ref_regular_nonweak = 0, dynamic_adjusted = 0, needs_copy = 0, needs_plt = 0,
non_elf = 0, versioned = versioned, 
  forced_local = 0, dynamic = 0, mark = 0, non_got_ref = 0, dynamic_def = 1,
ref_dynamic_nonweak = 0, pointer_equality_needed = 0, unique_global = 0,
protected_def = 0, start_stop = 0, 
  is_weakalias = 0, dynstr_index = 0, u = {alias = 0x811e77b70, elf_hash_value
= 34660121456}, verinfo = {verdef = 0x811073448, vertree = 0x811073448}, u2 =
{start_stop_section = 0x0, vtable = 0x0}}

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-toolchain mailing list