Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 May 2019 19:43:43 +0000
From:      bugzilla-noreply@freebsd.org
To:        toolchain@FreeBSD.org
Subject:   [Bug 237068] /usr/local/bin/ld: BFD (GNU Binutils) 2.30 assertion fail elflink.c:2824
Message-ID:  <bug-237068-29464-8ndgAPJmjK@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-237068-29464@https.bugs.freebsd.org/bugzilla/>
References:  <bug-237068-29464@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D237068

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

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

--- Comment #8 from Mark Millard <marklmi26-fbsd@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 =3D 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 =3D def;
         while ((h =3D h->u.alias) !=3D def)
           h->is_weakalias =3D 0;
       }
     else
       {
         while (h->root.type =3D=3D bfd_link_hash_indirect)
           h =3D (struct elf_link_hash_entry *) h->root.u.i.link;
         BFD_ASSERT (h->root.type =3D=3D bfd_link_hash_defined
                     || h->root.type =3D=3D bfd_link_hash_defweak);
         BFD_ASSERT (def->def_dynamic);
         BFD_ASSERT (def->root.type =3D=3D 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" "-sonam=
e"
"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=3D0x101dbc48 "BFD %s assertion fa=
il
%s:%d", ap=3D0x3fffffffffffcdc8 "") at bfd.c:1093
1093    {
(gdb) bt
#0  error_handler_internal (fmt=3D0x101dbc48 "BFD %s assertion fail %s:%d",
ap=3D0x3fffffffffffcdc8 "") at bfd.c:1093
#1  0x00000000100204e8 in ld_bfd_error_handler (fmt=3D<optimized out>,
ap=3D<optimized out>) at ./ldmain.c:187
#2  0x0000000010049b7c in _bfd_error_handler (fmt=3D<optimized out>) at
bfd.c:1178
#3  0x000000001002047c in ld_bfd_assert_handler (fmt=3D<optimized out>,
bfdver=3D<optimized out>, file=3D<optimized out>, line=3D<optimized out>) at
./ldmain.c:177
#4  0x0000000010049de4 in bfd_assert (file=3D<optimized out>, line=3D<optim=
ized
out>) at bfd.c:1429
#5  0x00000000100a520c in _bfd_elf_fix_symbol_flags (h=3Dh@entry=3D0x811e77=
b70,
eif=3Deif@entry=3D0x3fffffffffffcf70) at elflink.c:2935
#6  0x00000000100a54a0 in _bfd_elf_link_assign_sym_version (h=3D0x811e77b70,
data=3D0x3fffffffffffd148) at elflink.c:2363
#7  0x0000000010053d28 in bfd_link_hash_traverse (htab=3D0x810e50000,
func=3D@0x10223720: 0x100a5460 <_bfd_elf_link_assign_sym_version>,
info=3D<optimized out>) at linker.c:669
#8  0x00000000100ab92c in bfd_elf_size_dynamic_sections
(output_bfd=3D0x810e4b000, soname=3D0x3fffffffffffdc87 "libLTO.so.6",
rpath=3D0x8105fee80 "$ORIGIN/../lib:/usr/local/lib", filter_shlib=3D0x0,=20
    audit=3D0x0, depaudit=3D0x0, auxiliary_filters=3D0x0, info=3D0x102324d8
<link_info>, sinterpptr=3D0x3fffffffffffd280) 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=3D<optimized out>, argv=3D<optimized o=
ut>) 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 =3D bfd_link_hash_defweak
is_weakalias =3D 1

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

So that was def (via weakdef) and def->root.type=3D=3Dbfd_link_hash_indirec=
t .

(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 =3D h->u.alias;
  return h;
}

(gdb) down
#5  0x00000000100a520c in _bfd_elf_fix_symbol_flags (h=3Dh@entry=3D0x811e77=
b70,
eif=3Deif@entry=3D0x3fffffffffffcf70) at elflink.c:2935
2935              BFD_ASSERT (def->root.type =3D=3D bfd_link_hash_defined);

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

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

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

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

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-237068-29464-8ndgAPJmjK>