Bug 18102 - gold -r generates corrupted relocatable file
Summary: gold -r generates corrupted relocatable file
Status: ASSIGNED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-10 12:18 UTC by H.J. Lu
Modified: 2015-03-22 04:02 UTC (History)
1 user (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 H.J. Lu 2015-03-10 12:18:32 UTC
On Linux/x86-64, when gold is used to generate libc_pic.os:

gcc -fuse-ld=gold   -nostdlib -nostartfiles -r -o /export/build/gnu/glibc-test/build-x86_64-linux/libc_pic.os \
 -Wl,-d -Wl,--whole-archive /export/build/gnu/glibc-test/build-x86_64-linux/libc_pic.a -o /export/build/gnu/glibc-test/build-x86_64-linux/libc_pic.os

libc_pic.os is corrupted.
Comment 1 Cary Coutant 2015-03-22 03:11:24 UTC
Please attach libc_pic.a.

More details, please: What is the nature of the corruption?
Comment 2 H.J. Lu 2015-03-22 03:31:14 UTC
Please try hjl/pr14995 branch from:

https://sourceware.org/git/?p=glibc.git;a=summary

and build glibc with ld.gold as ld. The build won't finish since
libc_pic.os is bad.
Comment 3 H.J. Lu 2015-03-22 03:33:53 UTC
You need to extra configure.ac patch to allow configure glibc
build with gold since gold won't be used to created share libraries
on hjl/pr14995 branch.
Comment 4 H.J. Lu 2015-03-22 04:02:56 UTC
I created hjl/gold branch so that you can use

CC="gcc -fuse-ld=gold" CXX="g++ -fuse-ld=gold" CFLAGS="-O2 -g" .../glibc/configure --prefix=/usr --target=x86_64-linux --build=x86_64-linux --host=x86_64-linux --enable-hardcoded-path-in-tests --enable-gold

to configure and build glibc with gold.  Many tests fail with glibc
built with gold:

make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/de_DE.ISO-8859-1/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/ja_JP.EUC-JP/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/de_DE.UTF-8/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/en_US.ANSI_X3.4-1968/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/en_US.UTF-8/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/da_DK.ISO-8859-1/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/ja_JP.SJIS/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/en_US.ISO-8859-1/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/hr_HR.ISO-8859-2/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/sv_SE.ISO-8859-1/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/fr_FR.ISO-8859-1/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/tr_TR.UTF-8/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/nb_NO.ISO-8859-1/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/cs_CZ.UTF-8/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/zh_TW.EUC-TW/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/fa_IR.UTF-8/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/nn_NO.ISO-8859-1/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/fr_FR.UTF-8/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/si_LK.UTF-8/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/ja_JP.UTF-8/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/tr_TR.ISO-8859-9/LC_CTYPE] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/localedata/en_GB.UTF-8/LC_CTYPE] Error 1
make[2]: *** [localedata/tests] Error 2
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/timezone/testdata/America/Sao_Paulo] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/timezone/testdata/Asia/Tokyo] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/timezone/testdata/America/New_York] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/timezone/testdata/Europe/Berlin] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/timezone/testdata/Etc/UTC] Error 1
make[3]: *** [/export/build/gnu/glibc-test/build-x86_64-linux/timezone/testdata/Australia/Melbourne] Error 1
make[2]: *** [timezone/tests] Error 2

due to Segmentation fault.