[PATCH] D49678: [llvm-objcopy] Adding support for compressed DWARF debug sections.

Puyan Lotfi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 14 12:59:41 PDT 2018


plotfi marked an inline comment as done.
plotfi added inline comments.


================
Comment at: include/llvm/Object/Compressor.h:65-77
+extern template Expected<std::vector<char>>
+compress<ELF32LE>(StringRef Contents, uint64_t Align,
+                  DebugCompressionType CompressionType);
+extern template Expected<std::vector<char>>
+compress<ELF64LE>(StringRef Contents, uint64_t Align,
+                  DebugCompressionType CompressionType);
+extern template Expected<std::vector<char>>
----------------
jhenderson wrote:
> plotfi wrote:
> > jhenderson wrote:
> > > I'm not sure you need all these additional extern declarations.
> > I did, couldn't get it to compile otherwise. There might be something I am missing with explicit template instantiation, but this is the best I could figure for now. 
> Are you sure that's still the case? In Visual Studio, I get red-squiggly underlines indicating that it doesn't like the code (although compilation works with it still there). I also can compile cleanly on Windows, although I haven't tried on Linux.
With:


```
template <typename ELFT>
Expected<std::vector<char>> compress(StringRef Contents, uint64_t Align,
                                     DebugCompressionType CompressionType);
template Expected<std::vector<char>>
compress<ELF32LE>(StringRef Contents, uint64_t Align,
                  DebugCompressionType CompressionType);
template Expected<std::vector<char>>
compress<ELF64LE>(StringRef Contents, uint64_t Align,
                  DebugCompressionType CompressionType);
template Expected<std::vector<char>>
compress<ELF32BE>(StringRef Contents, uint64_t Align,
                  DebugCompressionType CompressionType);
template Expected<std::vector<char>>
compress<ELF64BE>(StringRef Contents, uint64_t Align,
                  DebugCompressionType CompressionType);
```

I get tons of compile errors like these (with clang-6.0++):


```
../include/llvm/Object/Compressor.h:66:1: error: explicit instantiation of undefined function template 'compress'
compress<ELF32LE>(StringRef Contents, uint64_t Align,
^
../include/llvm/Object/Compressor.h:63:29: note: explicit instantiation refers here
Expected<std::vector<char>> compress(StringRef Contents, uint64_t Align,
```




================
Comment at: test/tools/llvm-objcopy/compress-debug-sections-zlib-gnu.test:8
+# RUN: yaml2obj %S/compress-debug-sections.test -o %t.o
+# RUN: llvm-objcopy --compress-debug-sections=zlib-gnu %t.o %t-zlib-gnu.o
+# RUN: llvm-objcopy --decompress-debug-sections %t-zlib-gnu.o %t-decompressed.o
----------------
jhenderson wrote:
> This test should probably test the section flags of the compressed section(s) to show whether SHF_COMPRESSED exists or not.
Not this test, but I will add that check to compress-debug-sections-zlib.test. GNU Style doesn't use or set that flag. 


Repository:
  rL LLVM

https://reviews.llvm.org/D49678





More information about the llvm-commits mailing list