This is a duplicate of http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48725. My GCC version is 4.6.0 release, working under Ubuntu 10.10 x64. gcc -### Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/.../x86_64-gcc-4.6.0/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../configure --prefix=/.../x86_64-gcc-4.6.0 --enable-shared --with-arch=native --enable-languages=c,c++ --enable-lto --enable-plugin --enable-gold --enable-linker-build-id --disable-multilib --enable-ld=default --with-plugin-ld=ld.gold Thread model: posix gcc version 4.6.0 (GCC) It uses binutils 2.21.51, installed with the same prefix "/.../x86_64-gcc-4.6.0". ld.gold --version GNU gold (GNU Binutils 2.21.51.20110414) 1.11 Copyright 2011 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty. I make p7zip 9.20.1, downloadable at p7zip.sourceforge.net. I use makefile named makefile.linux_amd64 with the following addition: OPTFLAGS=-O2 -flto When it comes to linking 7z.so, I get the following: ... make[1]: Entering directory `/???/p7zip_9.20.1/CPP/7zip/Bundles/Format7zFree' g++ -m64 -O2 -flto -pipe -s -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -DENV_UNIX -D_7ZIP_LARGE_PAGES -fPIC -DEXTERNAL_CODECS -DUNICODE -D_UNICODE -fPIC -shared -o ../../../../bin/7z.so wine_date_and_time.o myGetTickCount.o CRC.o IntToString.o MyMap.o MyString.o MyWindows.o MyXml.o StringConvert.o StringToInt.o MyVector.o UTFConvert.o Wildcard.o FileDir.o FileFind.o FileIO.o PropVariant.o PropVariantUtils.o Synchronization.o System.o Time.o InBuffer.o InOutTempBuffer.o CreateCoder.o CWrappers.o FilterCoder.o LimitedStreams.o LockedStream.o MethodId.o MethodProps.o MemBlocks.o OffsetStream.o OutBuffer.o OutMemStream.o ProgressMt.o ProgressUtils.o StreamBinder.o StreamObjects.o StreamUtils.o VirtThread.o ArchiveExports.o DllExports2.o ApmHandler.o ArjHandler.o Bz2Handler.o CpioHandler.o CramfsHandler.o DebHandler.o DeflateProps.o DmgHandler.o ElfHandler.o FatHandler.o FlvHandler.o GzHandler.o LzhHandler.o LzmaHandler.o MachoHandler.o MbrHandler.o MslzHandler.o MubHandler.o NtfsHandler.o PeHandler.o PpmdHandler.o RpmHandler.o SplitHandler.o SwfHandler.o SquashfsHandler.o VhdHandler.o XarHandler.o XzHandler.o ZHandler.o CoderMixer2.o CoderMixer2MT.o CrossThreadProgress.o DummyOutStream.o FindSignature.o InStreamWithCRC.o ItemNameUtils.o MultiStream.o OutStreamWithCRC.o OutStreamWithSha1.o HandlerOut.o ParseProperties.o 7zCompressionMode.o 7zDecode.o 7zEncode.o 7zExtract.o 7zFolderInStream.o 7zFolderOutStream.o 7zHandler.o 7zHandlerOut.o 7zHeader.o 7zIn.o 7zOut.o 7zProperties.o 7zSpecStream.o 7zUpdate.o 7zRegister.o CabBlockInStream.o CabHandler.o CabHeader.o CabIn.o CabRegister.o ChmHandler.o ChmHeader.o ChmIn.o ChmRegister.o ComHandler.o ComIn.o ComRegister.o HfsHandler.o HfsIn.o HfsRegister.o IsoHandler.o IsoHeader.o IsoIn.o IsoRegister.o NsisDecode.o NsisHandler.o NsisIn.o NsisRegister.o RarHandler.o RarHeader.o RarIn.o RarItem.o RarVolumeInStream.o RarRegister.o TarHandler.o TarHandlerOut.o TarHeader.o TarIn.o TarOut.o TarUpdate.o TarRegister.o UdfHandler.o UdfIn.o UdfRegister.o WimHandler.o WimHandlerOut.o WimIn.o WimRegister.o ZipAddCommon.o ZipHandler.o ZipHandlerOut.o ZipHeader.o ZipIn.o ZipItem.o ZipOut.o ZipUpdate.o ZipRegister.o CodecExports.o ArjDecoder1.o ArjDecoder2.o Bcj2Coder.o Bcj2Register.o BcjCoder.o BcjRegister.o BitlDecoder.o BranchCoder.o BranchMisc.o BranchRegister.o ByteSwap.o BZip2Crc.o BZip2Decoder.o BZip2Encoder.o BZip2Register.o CopyCoder.o CopyRegister.o Deflate64Register.o DeflateDecoder.o DeflateEncoder.o DeflateRegister.o DeltaFilter.o Lzma2Decoder.o Lzma2Encoder.o Lzma2Register.o ImplodeDecoder.o ImplodeHuffmanDecoder.o LzhDecoder.o LzmaDecoder.o LzmaEncoder.o LzmaRegister.o LzOutWindow.o Lzx86Converter.o LzxDecoder.o PpmdDecoder.o PpmdEncoder.o PpmdRegister.o PpmdZip.o QuantumDecoder.o ShrinkDecoder.o ZlibDecoder.o ZlibEncoder.o ZDecoder.o 7zAes.o 7zAesRegister.o HmacSha1.o MyAes.o Pbkdf2HmacSha1.o RandGen.o Rar20Crypto.o RarAes.o Sha1.o WzAes.o ZipCrypto.o ZipStrong.o 7zBuf2.o 7zStream.o Aes.o Alloc.o Bra.o Bra86.o BraIA64.o BwtSort.o Delta.o HuffEnc.o LzFind.o LzFindMt.o Lzma2Dec.o Lzma2Enc.o LzmaDec.o LzmaEnc.o MtCoder.o Ppmd7.o Ppmd7Dec.o Ppmd7Enc.o Ppmd8.o Ppmd8Dec.o Ppmd8Enc.o Sha256.o Sort.o Threads.o Xz.o XzCrc64.o XzDec.o XzEnc.o XzIn.o 7zCrc.o 7zCrcOpt.o -lpthread -ldl /.../x86_64-gcc-4.6.0/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld.gold: internal error in symtab_section, at ../../gold/layout.h:684 collect2: ld returned 1 exit status make[1]: *** [../../../../bin/7z.so] Error 1 With "-fuse-linker-plugin" added, I get the same error.
Gold fails to link if it is used in LLVM LTO: llvm-g++ -m64 -O2 -use-gold-plugin -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -DENV_UNIX -D_7ZIP_LARGE_PAGES -DBREAK_HANDLER -DUNICODE -D_UNICODE -o ../../../../bin/7za myGetTickCount.o wine_date_and_time.o myAddExeFlag.o mySplitCommandLine.o BenchCon.o ConsoleClose.o ExtractCallbackConsole.o List.o Main.o MainAr.o OpenCallbackConsole.o PercentPrinter.o UpdateCallbackConsole.o UserInputUtils.o CommandLineParser.o CRC.o IntToString.o ListFileUtils.o StdInStream.o StdOutStream.o MyString.o StringConvert.o StringToInt.o UTFConvert.o MyWindows.o MyVector.o Wildcard.o Error.o FileDir.o FileFind.o FileIO.o FileName.o PropVariant.o PropVariantConversions.o Synchronization.o System.o Time.o CreateCoder.o CWrappers.o FilePathAutoRename.o FileStreams.o FilterCoder.o InBuffer.o InOutTempBuffer.o LimitedStreams.o LockedStream.o MemBlocks.o MethodId.o MethodProps.o OffsetStream.o OutBuffer.o OutMemStream.o ProgressMt.o ProgressUtils.o StreamBinder.o StreamObjects.o StreamUtils.o VirtThread.o ArchiveCommandLine.o ArchiveExtractCallback.o ArchiveOpenCallback.o Bench.o DefaultName.o EnumDirItems.o Extract.o ExtractingFilePath.o LoadCodecs.o OpenArchive.o PropIDUtils.o SetProperties.o SortUtils.o TempFiles.o Update.o UpdateAction.o UpdateCallback.o UpdatePair.o UpdateProduce.o Bz2Handler.o DeflateProps.o GzHandler.o LzmaHandler.o PpmdHandler.o SplitHandler.o XzHandler.o ZHandler.o CoderMixer2.o CoderMixer2MT.o CrossThreadProgress.o DummyOutStream.o FindSignature.o HandlerOut.o InStreamWithCRC.o ItemNameUtils.o MultiStream.o OutStreamWithCRC.o ParseProperties.o 7zCompressionMode.o 7zDecode.o 7zEncode.o 7zExtract.o 7zFolderInStream.o 7zFolderOutStream.o 7zHandler.o 7zHandlerOut.o 7zHeader.o 7zIn.o 7zOut.o 7zProperties.o 7zSpecStream.o 7zUpdate.o 7zRegister.o CabBlockInStream.o CabHandler.o CabHeader.o CabIn.o CabRegister.o TarHandler.o TarHandlerOut.o TarHeader.o TarIn.o TarOut.o TarUpdate.o TarRegister.o ZipAddCommon.o ZipHandler.o ZipHandlerOut.o ZipHeader.o ZipIn.o ZipItem.o ZipOut.o ZipUpdate.o ZipRegister.o Bcj2Coder.o Bcj2Register.o BcjCoder.o BcjRegister.o BitlDecoder.o BranchCoder.o BranchMisc.o BranchRegister.o ByteSwap.o BZip2Crc.o BZip2Decoder.o BZip2Encoder.o BZip2Register.o CopyCoder.o CopyRegister.o Deflate64Register.o DeflateDecoder.o DeflateEncoder.o DeflateRegister.o DeltaFilter.o ImplodeDecoder.o ImplodeHuffmanDecoder.o Lzma2Decoder.o Lzma2Encoder.o Lzma2Register.o LzmaDecoder.o LzmaEncoder.o LzmaRegister.o LzOutWindow.o Lzx86Converter.o LzxDecoder.o PpmdDecoder.o PpmdEncoder.o PpmdRegister.o PpmdZip.o QuantumDecoder.o ShrinkDecoder.o ZDecoder.o 7zAes.o 7zAesRegister.o HmacSha1.o MyAes.o Pbkdf2HmacSha1.o RandGen.o Sha1.o WzAes.o ZipCrypto.o ZipStrong.o 7zStream.o Aes.o Alloc.o Bra.o Bra86.o BraIA64.o BwtSort.o Delta.o HuffEnc.o LzFind.o LzFindMt.o Lzma2Dec.o Lzma2Enc.o LzmaDec.o LzmaEnc.o MtCoder.o Ppmd7.o Ppmd7Dec.o Ppmd7Enc.o Ppmd8.o Ppmd8Dec.o Ppmd8Enc.o Sha256.o Sort.o Threads.o Xz.o XzCrc64.o XzDec.o XzEnc.o XzIn.o 7zCrc.o 7zCrcOpt.o -s -lpthread /.../bin/ld.gold: internal error in symtab_section, at ../../gold/layout.h:684 So this is likely not a bug in GCC.
CVSROOT: /cvs/src Module name: src Changes by: ian@sourceware.org 2011-06-29 21:26:41 Modified files: gold : ChangeLog layout.cc layout.h output.cc Log message: PR gold/12695 * layout.cc (Layout::symtab_section_shndx): New function. * layout.h (class Layout): Declare symtab_section_shndx. * output.cc (Output_section::write_header): Call it. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.774&r2=1.775 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/layout.cc.diff?cvsroot=src&r1=1.207&r2=1.208 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/layout.h.diff?cvsroot=src&r1=1.95&r2=1.96 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/output.cc.diff?cvsroot=src&r1=1.152&r2=1.153
I can't recreate this problem with current gcc and current gold sources. I also can't see any code path which could lead to this crash when using -shared. However, I can a code patch which could lead to this crash when using -r, so I fixed that. Please reopen this bug report if you can still recreate the problem.
Closing.