http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48725
Summary: 4.6.0 fails to link p7zip 9.20.1 with LTO and gold Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto AssignedTo: unassig...@gcc.gnu.org ReportedBy: gmark...@gmail.com 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 at 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. It seems like a bug in LTO.