[lld] r281084 - Compact InputSectionData from 64 to 48 bytes. NFC.

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 13:52:57 PDT 2016


On Fri, Sep 09, 2016 at 07:42:12PM -0000, Rafael Espindola via llvm-commits wrote:
> Author: rafael
> Date: Fri Sep  9 14:42:11 2016
> New Revision: 281084
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=281084&view=rev
> Log:
> Compact InputSectionData from 64 to 48 bytes. NFC.
> 

Hi,

I'm getting failures when linking lld with this commit:

LLVM: r281088
LLD: r281084


lib/liblldELF.a(InputSection.cpp.o): In function
`lld::elf::InputSectionBase<llvm::object::ELFType<(llvm::support::endianness)1,
false> >::uncompress()':
InputSection.cpp:(.text._ZN3lld3elf16InputSectionBaseIN4llvm6object7ELFTypeILNS2_7support10endiannessE1ELb0EEEE10uncompressEv[_ZN3lld3elf16InputSectionBaseIN4llvm6object7ELFTypeILNS2_7support10endiannessE1ELb0EEEE10uncompressEv]+0xb9):
undefined reference to `llvm::zlib::uncompress(llvm::StringRef, char*,
unsigned long&)'
lib/liblldELF.a(InputSection.cpp.o): In function
`lld::elf::InputSectionBase<llvm::object::ELFType<(llvm::support::endianness)0,
false> >::uncompress()':
InputSection.cpp:(.text._ZN3lld3elf16InputSectionBaseIN4llvm6object7ELFTypeILNS2_7support10endiannessE0ELb0EEEE10uncompressEv[_ZN3lld3elf16InputSectionBaseIN4llvm6object7ELFTypeILNS2_7support10endiannessE0ELb0EEEE10uncompressEv]+0xca):
undefined reference to `llvm::zlib::uncompress(llvm::StringRef, char*,
unsigned long&)'
lib/liblldELF.a(InputSection.cpp.o): In function
`lld::elf::InputSectionBase<llvm::object::ELFType<(llvm::support::endianness)1,
true> >::uncompress()':
InputSection.cpp:(.text._ZN3lld3elf16InputSectionBaseIN4llvm6object7ELFTypeILNS2_7support10endiannessE1ELb1EEEE10uncompressEv[_ZN3lld3elf16InputSectionBaseIN4llvm6object7ELFTypeILNS2_7support10endiannessE1ELb1EEEE10uncompressEv]+0xbf):
undefined reference to `llvm::zlib::uncompress(llvm::StringRef, char*,
unsigned long&)'
lib/liblldELF.a(InputSection.cpp.o): In function
`lld::elf::InputSectionBase<llvm::object::ELFType<(llvm::support::endianness)0,
true> >::uncompress()':
InputSection.cpp:(.text._ZN3lld3elf16InputSectionBaseIN4llvm6object7ELFTypeILNS2_7support10endiannessE0ELb1EEEE10uncompressEv[_ZN3lld3elf16InputSectionBaseIN4llvm6object7ELFTypeILNS2_7support10endiannessE0ELb1EEEE10uncompressEv]+0xc7):
undefined reference to `llvm::zlib::uncompress(llvm::StringRef, char*,
unsigned long&)'

-Tom

> Modified:
>     lld/trunk/ELF/InputSection.cpp
>     lld/trunk/ELF/InputSection.h
> 
> Modified: lld/trunk/ELF/InputSection.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=281084&r1=281083&r2=281084&view=diff
> ==============================================================================
> --- lld/trunk/ELF/InputSection.cpp (original)
> +++ lld/trunk/ELF/InputSection.cpp Fri Sep  9 14:42:11 2016
> @@ -50,8 +50,8 @@ template <class ELFT> size_t InputSectio
>  template <class ELFT>
>  ArrayRef<uint8_t> InputSectionBase<ELFT>::getSectionData() const {
>    if (Compressed)
> -    return ArrayRef<uint8_t>((const uint8_t *)Uncompressed.data(),
> -                             Uncompressed.size());
> +    return ArrayRef<uint8_t>((const uint8_t *)UncompressedData.get(),
> +                             UncompressedDataSize);
>    return check(this->File->getObj().getSectionContents(this->Header));
>  }
>  
> @@ -106,7 +106,10 @@ template <class ELFT> void InputSectionB
>      fatal(getName(this) + ": unsupported compression type");
>  
>    StringRef Buf((const char *)Data.data(), Data.size());
> -  if (zlib::uncompress(Buf, Uncompressed, Hdr->ch_size) != zlib::StatusOK)
> +  UncompressedDataSize = Hdr->ch_size;
> +  UncompressedData.reset(new char[UncompressedDataSize]);
> +  if (zlib::uncompress(Buf, UncompressedData.get(), UncompressedDataSize) !=
> +      zlib::StatusOK)
>      fatal(getName(this) + ": error uncompressing section");
>  }
>  
> 
> Modified: lld/trunk/ELF/InputSection.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=281084&r1=281083&r2=281084&view=diff
> ==============================================================================
> --- lld/trunk/ELF/InputSection.h (original)
> +++ lld/trunk/ELF/InputSection.h Fri Sep  9 14:42:11 2016
> @@ -61,8 +61,9 @@ public:
>  
>    StringRef Name;
>  
> -  // If a section is compressed, this vector has uncompressed section data.
> -  SmallVector<char, 0> Uncompressed;
> +  // If a section is compressed, this has the uncompressed section data.
> +  std::unique_ptr<char[]> UncompressedData;
> +  size_t UncompressedDataSize = 0;
>  
>    std::vector<Relocation> Relocations;
>  };
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list