bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/24846] New: gold internal error with --detect-odr-violations a


From: szotsaki at gmail dot com
Subject: [Bug gold/24846] New: gold internal error with --detect-odr-violations and -fsanitize=address,leak (dwarf_reader.cc:1656)
Date: Wed, 24 Jul 2019 12:43:59 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=24846

            Bug ID: 24846
           Summary: gold internal error with --detect-odr-violations and
                    -fsanitize=address,leak (dwarf_reader.cc:1656)
           Product: binutils
           Version: 2.32
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: szotsaki at gmail dot com
                CC: ian at airs dot com
  Target Milestone: ---

Created attachment 11920
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11920&action=edit
GDB outputs

First, gold issues several warnings related to ASAN:

ld.gold: warning: while linking libmocklib_lib.so: symbol
'__sanitizer::StackDepotGetStats()' defined in multiple places (possible ODR
violation):
  [...]/lib64/libasan.a(sanitizer_common_libcdep.o)
  [...]/lib64/libasan.a(sanitizer_stackdepot.o)

Then when it tries to link the whole executable it fails with the following
error message:

ld.gold: internal error in read_header_prolog, at
[...]/gcc-9.1.0/gold/dwarf_reader.cc:1656

If I remove the "-Wl,--detect-odr-violations" from GCC command line, it works
fine.

Other linking-time arguments which you may find interesting (omitting the
internal libraries):

-std=c++14
-flto
-o xy_unittest
-Wl,-rpath,$ORIGIN/../../../../_solib_x86_64/
-lpthread
-lrt
-pthread
-lrt
-pthread
-fsanitize=address,leak
--sysroot=external/gnu_toolchain/
-fuse-ld=gold
-l:libstdc++.a
-l:libgcc.a
-static-libgcc
-static-libstdc++
-lm
-ldl
-fPIC
-Wl,-z,relro,-z,now
-Wl,--build-id=sha1
-Wl,--warn-execstack
-Wl,--detect-odr-violations
-L [...]
-B [...]
-Wl,--compress-debug-sections=zlib
-Wl,--gdb-index

The only change required not to fail is the removal of
"--detect-odr-violations" while keeping ASAN turned on.

Compilation-time options passed to GCC:

'--sysroot=external/gnu_toolchain/'
-isystem [...]
-m64
'-march=corei7'
'-mfpmath=sse'
-msse4.2
-fPIC
-U_FORTIFY_SOURCE
-fstack-protector
'-fdiagnostics-color=always'
-Wall
-fno-omit-frame-pointer
-ffunction-sections
-fdata-sections
-fno-canonical-system-headers
'-std=c++14'
-flto
-g3
-Og
-MD
-MF xy.d
'-frandom-seed=xy.o'
-fPIC
-D_GNU_SOURCE
-no-canonical-prefixes
'-fsanitize=address,leak'
-c xy.cpp
-o xy.pic.o

GCC version: 9.1.0

Here is a short backtrace:

#0  gold::do_gold_unreachable (filename=filename@entry=0x882f68
"/home/aki/temp/all-compile-new/objdir-gcc/../gcc-9.1.0/gold/dwarf_reader.cc",
lineno=lineno@entry=1656, function=function@entry=0x883474
"read_header_prolog") at
/home/aki/temp/all-compile-new/objdir-gcc/../gcc-9.1.0/gold/gold.cc:100
#1  0x0000000000727805 in gold::Sized_dwarf_line_info<64,
false>::read_header_prolog (this=this@entry=0x18d0070, lineptr=<optimized out>)
at
/home/aki/temp/all-compile-new/objdir-gcc/../gcc-9.1.0/gold/../elfcpp/elfcpp_swap.h:377
#2  0x000000000072de68 in gold::Sized_dwarf_line_info<64,
false>::read_line_mappings (shndx=13, this=0x18d0070) at
/home/aki/temp/all-compile-new/objdir-gcc/../gcc-9.1.0/gold/dwarf_reader.cc:2047
#3  gold::Sized_dwarf_line_info<64, false>::read_line_mappings (this=0x18d0070,
shndx=13) at
/home/aki/temp/all-compile-new/objdir-gcc/../gcc-9.1.0/gold/dwarf_reader.cc:2047
#4  0x000000000072e25e in gold::Sized_dwarf_line_info<64,
false>::Sized_dwarf_line_info (this=0x18d0070, object=0x1ab3f00, read_shndx=13)
at
/home/aki/temp/all-compile-new/objdir-gcc/../gcc-9.1.0/gold/dwarf_reader.h:58
#5  0x0000000000725ad2 in gold::Dwarf_line_info::one_addr2line
(object=0x1ab3f00, shndx=13, offset=8553296, cache_size=cache_size@entry=16,
other_lines=other_lines@entry=0x7fffffff2fa0) at
/home/aki/temp/all-compile-new/objdir-gcc/../gcc-9.1.0/gold/dwarf_reader.cc:2369
#6  0x0000000000701983 in
gold::Symbol_table::linenos_from_loc[abi:cxx11](gold::Task const*,
gold::Symbol_location const&) (task=0x224ff00, loc=...) at
/home/aki/temp/all-compile-new/objdir-gcc/../gcc-9.1.0/gold/symtab.cc:3515
#7  0x00000000007028e0 in gold::Symbol_table::detect_odr_violations
(this=<optimized out>, task=task@entry=0x224ff00, output_file_name=0x97ef10
"bazel-out/k8-dbg-ubsan/bin/platform/aas/pas/sysmon/blkInfoInst_unittest") at
/home/aki/temp/all-compile-new/objdir-gcc/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/ext/aligned_buffer.h:114
#8  0x000000000063aebe in gold::Layout_task_runner::run (this=0x224fec0,
workqueue=0x7fffffff3260, task=0x224ff00) at
/home/aki/temp/all-compile-new/objdir-gcc/../gcc-9.1.0/gold/options.h:1540
#9  0x00000000007188ef in gold::Task_function::run (workqueue=0x7fffffff3260,
this=0x224ff00) at
/home/aki/temp/all-compile-new/objdir-gcc/../gcc-9.1.0/gold/workqueue.h:178
#10 gold::Workqueue::find_and_run_task (this=0x7fffffff3260, thread_number=0)
at /home/aki/temp/all-compile-new/objdir-gcc/../gcc-9.1.0/gold/workqueue.cc:319
#11 0x0000000000718d8a in gold::Workqueue::process
(this=this@entry=0x7fffffff3260, thread_number=thread_number@entry=0) at
/home/aki/temp/all-compile-new/objdir-gcc/../gcc-9.1.0/gold/workqueue.cc:495
#12 0x00000000004163ea in main (argc=<optimized out>, argv=<optimized out>) at
/home/aki/temp/all-compile-new/objdir-gcc/../gcc-9.1.0/gold/main.cc:252

Here, you can see that "gold::Symbol_table::detect_odr_violations" is indeed
called and from that an assertion happened (though I don't know the exact
reasons).

I created a hopefully usable GDB file with some comments. Seek for lines
beginning with "$nn" (where "n" is a number).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]