Details
Diff Detail
Event Timeline
test/tools/obj2yaml/elf-ent-size.yaml | ||
---|---|---|
1 ↗ | (On Diff #183515) | Nit: rename the test elf-entsize.yaml, since entsize is all one "word" in the field name. |
12 ↗ | (On Diff #183515) | You can simplify this somewhat by a) getting rid of the .text section, b) getting rid of the symbol, and c) removing the content and AddressAlign fields from the .rodata.cst4 section. |
tools/obj2yaml/elf2yaml.cpp | ||
321 | Why are we casting this, but none of the other fields? |
test/tools/obj2yaml/elf-ent-size.yaml | ||
---|---|---|
1 ↗ | (On Diff #183515) | OK. FWIW naming was based on a similar test from yaml2obj folder (llvm\test\tools\yam2obj\elf-ent-size.yaml) (Oh, and it was me who committed it initially..). Thanks :) |
tools/obj2yaml/elf2yaml.cpp | ||
321 | EntSize is the only Optional<llvm::yaml::Hex64> here. Without the cast I have an error: 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): error C2679: binary '=': no operator found which takes a right-hand operand of type 'const llvm::support::detail::packed_endian_specific_integral<uint32_t,llvm::support::little,1>' (or there is no acceptable conversion) 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(150): note: could be 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const llvm::Optional<llvm::yaml::Hex64> &)' 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(146): note: or 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const T &)' 1> with 1> [ 1> T=llvm::yaml::Hex64 1> ] 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(133): note: or 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(llvm::Optional<llvm::yaml::Hex64> &&)' 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(129): note: or 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(T &&)' 1> with 1> [ 1> T=llvm::yaml::Hex64 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): note: while trying to match the argument list '(llvm::Optional<llvm::yaml::Hex64>, const llvm::support::detail::packed_endian_specific_integral<uint32_t,llvm::support::little,1>)' 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(315): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)' 1> with 1> [ 1> ELFT=llvm::object::ELF32LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(420): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF32LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(205): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)' 1> with 1> [ 1> ELFT=llvm::object::ELF32LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(194): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF32LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(71): note: while compiling class template member function '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)' 1> with 1> [ 1> ELFT=llvm::object::ELF32LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to function template instantiation '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF32LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to class template instantiation '`anonymous-namespace'::ELFDumper<ELFT>' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF32LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(537): note: see reference to function template instantiation 'std::error_code elf2yaml<llvm::object::ELF32LE>(llvm::raw_ostream &,const llvm::object::ELFFile<llvm::object::ELF32LE> &)' being compiled 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): error C2679: binary '=': no operator found which takes a right-hand operand of type 'const llvm::support::detail::packed_endian_specific_integral<uint32_t,llvm::support::big,1>' (or there is no acceptable conversion) 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(150): note: could be 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const llvm::Optional<llvm::yaml::Hex64> &)' 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(146): note: or 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const T &)' 1> with 1> [ 1> T=llvm::yaml::Hex64 1> ] 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(133): note: or 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(llvm::Optional<llvm::yaml::Hex64> &&)' 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(129): note: or 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(T &&)' 1> with 1> [ 1> T=llvm::yaml::Hex64 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): note: while trying to match the argument list '(llvm::Optional<llvm::yaml::Hex64>, const llvm::support::detail::packed_endian_specific_integral<uint32_t,llvm::support::big,1>)' 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(315): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)' 1> with 1> [ 1> ELFT=llvm::object::ELF32BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(420): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF32BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(205): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)' 1> with 1> [ 1> ELFT=llvm::object::ELF32BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(194): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF32BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(71): note: while compiling class template member function '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)' 1> with 1> [ 1> ELFT=llvm::object::ELF32BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to function template instantiation '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF32BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to class template instantiation '`anonymous-namespace'::ELFDumper<ELFT>' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF32BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(540): note: see reference to function template instantiation 'std::error_code elf2yaml<llvm::object::ELF32BE>(llvm::raw_ostream &,const llvm::object::ELFFile<llvm::object::ELF32BE> &)' being compiled 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): error C2679: binary '=': no operator found which takes a right-hand operand of type 'const llvm::support::detail::packed_endian_specific_integral<uint64_t,llvm::support::little,1>' (or there is no acceptable conversion) 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(150): note: could be 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const llvm::Optional<llvm::yaml::Hex64> &)' 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(146): note: or 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const T &)' 1> with 1> [ 1> T=llvm::yaml::Hex64 1> ] 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(133): note: or 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(llvm::Optional<llvm::yaml::Hex64> &&)' 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(129): note: or 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(T &&)' 1> with 1> [ 1> T=llvm::yaml::Hex64 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): note: while trying to match the argument list '(llvm::Optional<llvm::yaml::Hex64>, const llvm::support::detail::packed_endian_specific_integral<uint64_t,llvm::support::little,1>)' 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(315): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)' 1> with 1> [ 1> ELFT=llvm::object::ELF64LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(420): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF64LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(205): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)' 1> with 1> [ 1> ELFT=llvm::object::ELF64LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(194): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF64LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(71): note: while compiling class template member function '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)' 1> with 1> [ 1> ELFT=llvm::object::ELF64LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to function template instantiation '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF64LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to class template instantiation '`anonymous-namespace'::ELFDumper<ELFT>' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF64LE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(543): note: see reference to function template instantiation 'std::error_code elf2yaml<llvm::object::ELF64LE>(llvm::raw_ostream &,const llvm::object::ELFFile<llvm::object::ELF64LE> &)' being compiled 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): error C2679: binary '=': no operator found which takes a right-hand operand of type 'const llvm::support::detail::packed_endian_specific_integral<uint64_t,llvm::support::big,1>' (or there is no acceptable conversion) 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(150): note: could be 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const llvm::Optional<llvm::yaml::Hex64> &)' 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(146): note: or 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(const T &)' 1> with 1> [ 1> T=llvm::yaml::Hex64 1> ] 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(133): note: or 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(llvm::Optional<llvm::yaml::Hex64> &&)' 1>D:\Work2\llvm\llvm\include\llvm/ADT/Optional.h(129): note: or 'llvm::Optional<llvm::yaml::Hex64> &llvm::Optional<llvm::yaml::Hex64>::operator =(T &&)' 1> with 1> [ 1> T=llvm::yaml::Hex64 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(321): note: while trying to match the argument list '(llvm::Optional<llvm::yaml::Hex64>, const llvm::support::detail::packed_endian_specific_integral<uint64_t,llvm::support::big,1>)' 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(315): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)' 1> with 1> [ 1> ELFT=llvm::object::ELF64BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(420): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpCommonSection(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::Section &)' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF64BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(205): note: while compiling class template member function 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)' 1> with 1> [ 1> ELFT=llvm::object::ELF64BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(194): note: see reference to function template instantiation 'std::error_code `anonymous-namespace'::ELFDumper<ELFT>::dumpSymbols(const llvm::object::Elf_Shdr_Impl<ELFT> *,llvm::ELFYAML::LocalGlobalWeakSymbols &)' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF64BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(71): note: while compiling class template member function '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)' 1> with 1> [ 1> ELFT=llvm::object::ELF64BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to function template instantiation '`anonymous-namespace'::ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> &)' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF64BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(523): note: see reference to class template instantiation '`anonymous-namespace'::ELFDumper<ELFT>' being compiled 1> with 1> [ 1> ELFT=llvm::object::ELF64BE 1> ] 1>D:\Work2\llvm\llvm\tools\obj2yaml\elf2yaml.cpp(546): note: see reference to function template instantiation 'std::error_code elf2yaml<llvm::object::ELF64BE>(llvm::raw_ostream &,const llvm::object::ELFFile<llvm::object::ELF64BE> &)' being compiled 1>Done building project "obj2yaml.vcxproj" -- FAILED. |
LGTM.
tools/obj2yaml/elf2yaml.cpp | ||
---|---|---|
321 | Okay. Use static_cast, I think, unless there's precedent for C-style casts in this project. |
Why are we casting this, but none of the other fields?