Bug 15192 - Failes to build Chromium project with the gold64 linker and incremental linkage.
Summary: Failes to build Chromium project with the gold64 linker and incremental linkage.
Status: ASSIGNED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.21
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-25 09:46 UTC by abyss.7
Modified: 2016-03-27 20:22 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description abyss.7 2013-02-25 09:46:50 UTC
I want to use the gold64 linker feature - an incremental linkage. But it failes with the following error:
 
[2790/11302] SOLINK lib/libbase_i18n.so
FAILED: if [ ! -e lib/libbase_i18n.so -o ! -e lib/libbase_i18n.so.TOC ]; then flock linker.lock g++ -shared -Wl,-z,now -Wl,-z,relro -pthread -Wl,-z,noexecstack -fPIC -Wl,--threads -Wl,--thread-count=4 -Wl,--incremental -B../../third_party/gold -Wl,--icf=none -o lib/libbase_i18n.so -Wl,-soname=libbase_i18n.so -Wl,--whole-archive obj/base/i18n/base_i18n.bidi_line_iterator.o obj/base/i18n/base_i18n.break_iterator.o obj/base/i18n/base_i18n.char_iterator.o obj/base/i18n/base_i18n.case_conversion.o obj/base/i18n/base_i18n.file_util_icu.o obj/base/i18n/base_i18n.icu_encoding_detection.o obj/base/i18n/base_i18n.icu_string_conversions.o obj/base/i18n/base_i18n.icu_util.o obj/base/i18n/base_i18n.number_formatting.o obj/base/i18n/base_i18n.rtl.o obj/base/i18n/base_i18n.string_search.o obj/base/i18n/base_i18n.time_formatting.o obj/base/third_party/dynamic_annotations/libdynamic_annotations.a lib/libicui18n.so lib/libbase.so lib/libicuuc.so -Wl,--no-whole-archive -lrt -ldl -lgmodule-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgthread-2.0 -lglib-2.0 && { readelf -d lib/libbase_i18n.so | grep SONAME ; nm -gD -f p lib/libbase_i18n.so | cut -f1-2 -d' '; } > lib/libbase_i18n.so.TOC; else flock linker.lock g++ -shared -Wl,-z,now -Wl,-z,relro -pthread -Wl,-z,noexecstack -fPIC -Wl,--threads -Wl,--thread-count=4 -Wl,--incremental -B../../third_party/gold -Wl,--icf=none -o lib/libbase_i18n.so -Wl,-soname=libbase_i18n.so -Wl,--whole-archive obj/base/i18n/base_i18n.bidi_line_iterator.o obj/base/i18n/base_i18n.break_iterator.o obj/base/i18n/base_i18n.char_iterator.o obj/base/i18n/base_i18n.case_conversion.o obj/base/i18n/base_i18n.file_util_icu.o obj/base/i18n/base_i18n.icu_encoding_detection.o obj/base/i18n/base_i18n.icu_string_conversions.o obj/base/i18n/base_i18n.icu_util.o obj/base/i18n/base_i18n.number_formatting.o obj/base/i18n/base_i18n.rtl.o obj/base/i18n/base_i18n.string_search.o obj/base/i18n/base_i18n.time_formatting.o obj/base/third_party/dynamic_annotations/libdynamic_annotations.a lib/libicui18n.so lib/libbase.so lib/libicuuc.so -Wl,--no-whole-archive -lrt -ldl -lgmodule-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgthread-2.0 -lglib-2.0 && { readelf -d lib/libbase_i18n.so | grep SONAME ; nm -gD -f p lib/libbase_i18n.so | cut -f1-2 -d' '; } > lib/libbase_i18n.so.tmp && if ! cmp -s lib/libbase_i18n.so.tmp lib/libbase_i18n.so.TOC; then mv lib/libbase_i18n.so.tmp lib/libbase_i18n.so.TOC ; fi; fi
../../third_party/gold/gold64: internal error in write_to_buffer, at stringpool.cc:479
collect2: error: ld returned 1 exit status
 
I modified src/build/common.gypi in the following way:

['linux_use_gold_flags==1', {
            'ldflags': [
              # Experimentation found that using four linking threads
              # saved ~20% of link time.
              # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
              '-Wl,--threads',
              '-Wl,--thread-count=4',
              '-Wl,--incremental',        # <--- My addition.
            ],

This change adds '--incremental' flag to every invocation of linker.

Does it even supposed to work at all? Or, may be, am I doing anything wrong?
Or may be the version in the Chromium source tree is too old.
Comment 1 Cary Coutant 2016-03-27 20:22:00 UTC
Might be a threading problem. Does it reproduce with --no-threads?