Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

ObjWriter for armel tizen #3776

Closed
sergign60 opened this issue Jun 2, 2017 · 14 comments
Closed

ObjWriter for armel tizen #3776

sergign60 opened this issue Jun 2, 2017 · 14 comments

Comments

@sergign60
Copy link
Contributor

sergign60 commented Jun 2, 2017

We tried to build ObjWriter for armel tizen from the current version of https://github.com/dotnet/llilc. But we found that it is too old, in particular there are some sections in CoreRT that are not processed by ObjWriter from this repository. Where can we take more up-to-date version of it with the appropriate building instructions?

@sergign60
Copy link
Contributor Author

sergign60 commented Jun 2, 2017

@jkotas
Copy link
Member

jkotas commented Jun 2, 2017

https://github.com/dotnet/llilc/tree/ObjectWriter branch should be up-to-date. @sandreenko Is there anything non-obvious how to get it built?

@BredPet
Copy link
Contributor

BredPet commented Jun 2, 2017

In master there is old ObjWriter version, if we build this version with llvm MS brach, we get error:
Unsupported section
and if we ignore it, we get:

System.EntryPointNotFoundException: Unable to find an entry point named 'SetCodeSectionAttribute' in DLL 'objwriter'.
at ILCompiler.DependencyAnalysis.ObjectWriter.SetCodeSectionAttribute(IntPtr objWriter, String sectionName, CustomSectionAttributes attributes, String comdatName)
at ILCompiler.DependencyAnalysis.ObjectWriter.SetCodeSectionAttribute(ObjectNodeSection section)
at ILCompiler.DependencyAnalysis.ObjectWriter.EmitObject(String objectFilePath, IEnumerable`1 nodes, NodeFactory factory, IObjectDumper dumper)
at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper)
at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper)
at ILCompiler.Program.Run(String[] args)
at ILCompiler.Program.Main(String[] args)

i.e. in ObjWriter missed SetCodeSectionAttribute function.
I found that in llilc exists ObjectWriter branch, which @jkotas said above. But this branch of ObjWriter is not compiled with LLVM MS branch. I got errors:

/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp: In member function 'bool ObjectWriter::Init(llvm::StringRef)':
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:116:48: error: no matching function for call to 'llvm::MCObjectFileInfo::InitMCObjectFileInfo(llvm::Triple&, bool, llvm::CodeModel::Model, llvm::MCContext&)'
                                     *OutContext);
                                                ^
In file included from /llvm/tools/llilc/lib/ObjWriter/objwriter.h:14:0,
                 from /llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:16:
/llvm/include/llvm/MC/MCObjectFileInfo.h:195:8: note: candidate: void llvm::MCObjectFileInfo::InitMCObjectFileInfo(const llvm::Triple&, llvm::Reloc::Model, llvm::CodeModel::Model, llvm::MCContext&)
   void InitMCObjectFileInfo(const Triple &TT, Reloc::Model RM,
        ^~~~~~~~~~~~~~~~~~~~
/llvm/include/llvm/MC/MCObjectFileInfo.h:195:8: note:   no known conversion for argument 2 from 'bool' to 'llvm::Reloc::Model'
In file included from /llvm/include/llvm/ADT/StringRef.h:13:0,
                 from /llvm/include/llvm/ADT/StringMap.h:17,
                 from /llvm/include/llvm/Support/Host.h:17,
                 from /llvm/include/llvm/ADT/Hashing.h:49,
                 from /llvm/include/llvm/ADT/ArrayRef.h:13,
                 from /llvm/include/llvm/ADT/DenseMapInfo.h:17,
                 from /llvm/include/llvm/ADT/DenseMap.h:17,
                 from /llvm/include/llvm/ADT/MapVector.h:20,
                 from /llvm/include/llvm/CodeGen/AsmPrinter.h:19,
                 from /llvm/tools/llilc/lib/ObjWriter/objwriter.h:11,
                 from /llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:16:
/llvm/include/llvm/MC/MCObjectFileInfo.h:198:12: note: candidate: void llvm::MCObjectFileInfo::InitMCObjectFileInfo(llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model, llvm::MCContext&)
       void InitMCObjectFileInfo(StringRef TT, Reloc::Model RM,
            ^
/llvm/include/llvm/Support/Compiler.h:245:3: note: in definition of macro 'LLVM_ATTRIBUTE_DEPRECATED'
   decl __attribute__((deprecated))
   ^~~~
/llvm/include/llvm/MC/MCObjectFileInfo.h:198:12: note:   no known conversion for argument 1 from 'llvm::Triple' to 'llvm::StringRef'
       void InitMCObjectFileInfo(StringRef TT, Reloc::Model RM,
            ^
/llvm/include/llvm/Support/Compiler.h:245:3: note: in definition of macro 'LLVM_ATTRIBUTE_DEPRECATED'
   decl __attribute__((deprecated))
   ^~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:135:60: error: no matching function for call to 'llvm::Target::createMCAsmBackend(llvm::MCRegisterInfo&, std::__cxx11::string&, std::__cxx11::string&, llvm::MCTargetOptions&) const'
                                              TargetMOptions);
                                                            ^
In file included from /llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:46:0:
/llvm/include/llvm/Support/TargetRegistry.h:375:17: note: candidate: llvm::MCAsmBackend* llvm::Target::createMCAsmBackend(const llvm::MCRegisterInfo&, llvm::StringRef, llvm::StringRef) const
   MCAsmBackend *createMCAsmBackend(const MCRegisterInfo &MRI,
                 ^~~~~~~~~~~~~~~~~~
/llvm/include/llvm/Support/TargetRegistry.h:375:17: note:   candidate expects 3 arguments, 4 provided
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:149:70: error: no matching function for call to 'llvm::Target::createTargetMachine(std::__cxx11::string&, std::__cxx11::string&, std::__cxx11::string&, llvm::TargetOptions, const llvm::NoneType&) const'
                                                 TargetOptions(), None));
                                                                      ^
In file included from /llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:46:0:
/llvm/include/llvm/Support/TargetRegistry.h:361:3: note: candidate: llvm::TargetMachine* llvm::Target::createTargetMachine(llvm::StringRef, llvm::StringRef, llvm::StringRef, const llvm::TargetOptions&, llvm::Reloc::Model, llvm::CodeModel::Model, llvm::CodeGenOpt::Level) const
   createTargetMachine(StringRef TT, StringRef CPU, StringRef Features,
   ^~~~~~~~~~~~~~~~~~~
/llvm/include/llvm/Support/TargetRegistry.h:361:3: note:   no known conversion for argument 5 from 'const llvm::NoneType' to 'llvm::Reloc::Model'
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp: In member function 'void ObjectWriter::EmitSymRecord(int, llvm::codeview::SymbolRecordKind)':
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:458:3: error: 'RecordPrefix' was not declared in this scope
   RecordPrefix Rec;
   ^~~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:459:3: error: 'Rec' was not declared in this scope
   Rec.RecordLen = ulittle16_t(Size + sizeof(ulittle16_t));
   ^~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp: In member function 'void ObjectWriter::EmitCVDebugVarInfo(const llvm::MCSymbol*, const DebugVarInfo*, int)':
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:488:5: error: 'LocalSymFlags' was not declared in this scope
     LocalSymFlags Flags = LocalSymFlags::None;
     ^~~~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:489:48: error: 'Flags' was not declared in this scope
     unsigned SizeofSym = sizeof(Type) + sizeof(Flags);
                                                ^~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:491:43: error: 'LocalSym' is not a member of 'llvm::codeview::SymbolRecordKind'
     EmitSymRecord(SizeofSym + NameLength, SymbolRecordKind::LocalSym);
                                           ^~~~~~~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:493:16: error: 'LocalSymFlags' is not a class, namespace, or enumeration
       Flags |= LocalSymFlags::IsParameter;
                ^~~~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:511:39: error: 'DefRangeRegisterSym' is not a member of 'llvm::codeview::SymbolRecordKind'
         SymbolRecordKind SymbolKind = SymbolRecordKind::DefRangeRegisterSym;
                                       ^~~~~~~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:512:53: error: 'Hdr' is not a member of 'llvm::codeview::DefRangeRegisterSym'
         unsigned SizeofDefRangeRegisterSym = sizeof(DefRangeRegisterSym::Hdr) +
                                                     ^~~~~~~~~~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:516:62: error: no matching function for call to 'llvm::codeview::DefRangeRegisterSym::DefRangeRegisterSym(llvm::codeview::SymbolRecordKind&)'
         DefRangeRegisterSym DefRangeRegisterSymbol(SymbolKind);
                                                              ^
In file included from /llvm/tools/llilc/lib/ObjWriter/jitDebugInfo.h:9:0,
                 from /llvm/tools/llilc/lib/ObjWriter/objwriter.h:19,
                 from /llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:16:
/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h:144:8: note: candidate: llvm::codeview::DefRangeRegisterSym::DefRangeRegisterSym()
 struct DefRangeRegisterSym {
        ^~~~~~~~~~~~~~~~~~~
/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h:144:8: note:   candidate expects 0 arguments, 1 provided
/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h:144:8: note: candidate: constexpr llvm::codeview::DefRangeRegisterSym::DefRangeRegisterSym(const llvm::codeview::DefRangeRegisterSym&)
/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h:144:8: note:   no known conversion for argument 1 from 'llvm::codeview::SymbolRecordKind' to 'const llvm::codeview::DefRangeRegisterSym&'
/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h:144:8: note: candidate: constexpr llvm::codeview::DefRangeRegisterSym::DefRangeRegisterSym(llvm::codeview::DefRangeRegisterSym&&)
/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h:144:8: note:   no known conversion for argument 1 from 'llvm::codeview::SymbolRecordKind' to 'llvm::codeview::DefRangeRegisterSym&&'
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:521:32: error: 'struct llvm::codeview::DefRangeRegisterSym' has no member named 'Hdr'
         DefRangeRegisterSymbol.Hdr.Register =
                                ^~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:523:57: error: 'struct llvm::codeview::DefRangeRegisterSym' has no member named 'Hdr'
         unsigned Length = sizeof(DefRangeRegisterSymbol.Hdr);
                                                         ^~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:525:55: error: 'struct llvm::codeview::DefRangeRegisterSym' has no member named 'Hdr'
             StringRef((char *)&DefRangeRegisterSymbol.Hdr, Length));
                                                       ^~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:543:39: error: 'DefRangeRegisterRelSym' is not a member of 'llvm::codeview::SymbolRecordKind'
         SymbolRecordKind SymbolKind = SymbolRecordKind::DefRangeRegisterRelSym;
                                       ^~~~~~~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:545:20: error: 'Hdr' is not a member of 'llvm::codeview::DefRangeRegisterRelSym'
             sizeof(DefRangeRegisterRelSym::Hdr) +
                    ^~~~~~~~~~~~~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:549:68: error: no matching function for call to 'llvm::codeview::DefRangeRegisterRelSym::DefRangeRegisterRelSym(llvm::codeview::SymbolRecordKind&)'
         DefRangeRegisterRelSym DefRangeRegisterRelSymbol(SymbolKind);
                                                                    ^
In file included from /llvm/tools/llilc/lib/ObjWriter/jitDebugInfo.h:9:0,
                 from /llvm/tools/llilc/lib/ObjWriter/objwriter.h:19,
                 from /llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:16:
/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h:173:8: note: candidate: llvm::codeview::DefRangeRegisterRelSym::DefRangeRegisterRelSym()
 struct DefRangeRegisterRelSym {
        ^~~~~~~~~~~~~~~~~~~~~~
/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h:173:8: note:   candidate expects 0 arguments, 1 provided
/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h:173:8: note: candidate: constexpr llvm::codeview::DefRangeRegisterRelSym::DefRangeRegisterRelSym(const llvm::codeview::DefRangeRegisterRelSym&)
/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h:173:8: note:   no known conversion for argument 1 from 'llvm::codeview::SymbolRecordKind' to 'const llvm::codeview::DefRangeRegisterRelSym&'
/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h:173:8: note: candidate: constexpr llvm::codeview::DefRangeRegisterRelSym::DefRangeRegisterRelSym(llvm::codeview::DefRangeRegisterRelSym&&)
/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h:173:8: note:   no known conversion for argument 1 from 'llvm::codeview::SymbolRecordKind' to 'llvm::codeview::DefRangeRegisterRelSym&&'
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:554:35: error: 'struct llvm::codeview::DefRangeRegisterRelSym' has no member named 'Hdr'
         DefRangeRegisterRelSymbol.Hdr.Register =
                                   ^~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:556:35: error: 'struct llvm::codeview::DefRangeRegisterRelSym' has no member named 'Hdr'
         DefRangeRegisterRelSymbol.Hdr.BasePointerOffset =
                                   ^~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:559:60: error: 'struct llvm::codeview::DefRangeRegisterRelSym' has no member named 'Hdr'
         unsigned Length = sizeof(DefRangeRegisterRelSymbol.Hdr);
                                                            ^~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:561:58: error: 'struct llvm::codeview::DefRangeRegisterRelSym' has no member named 'Hdr'
             StringRef((char *)&DefRangeRegisterRelSymbol.Hdr, Length));
                                                          ^~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp: In member function 'void ObjectWriter::EmitCVDebugFunctionInfo(const char*, int)':
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:608:24: error: 'GlobalProcIdSym' is not a member of 'llvm::codeview::SymbolRecordKind'
     ProcSym ProcSymbol(SymbolRecordKind::GlobalProcIdSym);
                        ^~~~~~~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:614:27: error: 'struct llvm::codeview::ProcSym' has no member named 'Parent'; did you mean 'PtrParent'?
         sizeof(ProcSymbol.Parent) + sizeof(ProcSymbol.End) +
                           ^~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:614:55: error: 'struct llvm::codeview::ProcSym' has no member named 'End'; did you mean 'PtrEnd'?
         sizeof(ProcSymbol.Parent) + sizeof(ProcSymbol.End) +
                                                       ^~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:615:27: error: 'struct llvm::codeview::ProcSym' has no member named 'Next'; did you mean 'PtrNext'?
         sizeof(ProcSymbol.Next) + sizeof(ProcSymbol.CodeSize) +
                           ^~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:619:31: error: 'GlobalProcIdSym' is not a member of 'llvm::codeview::SymbolRecordKind'
     EmitSymRecord(SymbolSize, SymbolRecordKind::GlobalProcIdSym);
                               ^~~~~~~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:621:55: error: 'struct llvm::codeview::ProcSym' has no member named 'Parent'; did you mean 'PtrParent'?
     Streamer->EmitBytes(StringRef((char *)&ProcSymbol.Parent, HeaderSize));
                                                       ^~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:623:37: error: no matching function for call to 'llvm::MCObjectStreamer::EmitCOFFSecRel32(llvm::MCSymbol*&, int)'
     Streamer->EmitCOFFSecRel32(Fn, 0);
                                     ^
In file included from /llvm/include/llvm/MC/MCObjectStreamer.h:16:0,
                 from /llvm/tools/llilc/lib/ObjWriter/typeBuilder.h:15,
                 from /llvm/tools/llilc/lib/ObjWriter/objwriter.h:22,
                 from /llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:16:
/llvm/include/llvm/MC/MCStreamer.h:459:16: note: candidate: virtual void llvm::MCStreamer::EmitCOFFSecRel32(const llvm::MCSymbol*)
   virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
                ^~~~~~~~~~~~~~~~
/llvm/include/llvm/MC/MCStreamer.h:459:16: note:   candidate expects 1 argument, 2 provided
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:641:22: error: 'ProcEnd' is not a member of 'llvm::codeview::SymbolRecordKind'
     EmitSymRecord(0, SymbolRecordKind::ProcEnd);
                      ^~~~~~~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp: In member function 'void ObjectWriter::EmitDebugFunctionInfo(const char*, int)':
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:666:15: error: 'class llvm::MCObjectStreamer' has no member named 'EmitCVFuncIdDirective'; did you mean 'EmitCVLocDirective'?
     Streamer->EmitCVFuncIdDirective(FuncId);
               ^~~~~~~~~~~~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:673:78: error: invalid conversion from 'llvm::MCSymbol*' to 'llvm::MCSymbolELF*' [-fpermissive]
                             MCConstantExpr::create(FunctionSize, *OutContext));
                                                                              ^
In file included from /llvm/include/llvm/MC/MCObjectStreamer.h:16:0,
                 from /llvm/tools/llilc/lib/ObjWriter/typeBuilder.h:15,
                 from /llvm/tools/llilc/lib/ObjWriter/objwriter.h:22,
                 from /llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:16:
/llvm/include/llvm/MC/MCStreamer.h:472:16: note:   initializing argument 1 of 'virtual void llvm::MCStreamer::emitELFSize(llvm::MCSymbolELF*, const llvm::MCExpr*)'
   virtual void emitELFSize(MCSymbolELF *Symbol, const MCExpr *Value);
                ^~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp: In member function 'void ObjectWriter::EmitDebugLoc(int, int, int, int)':
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:697:15: error: 'class llvm::MCObjectStreamer' has no member named 'EmitCVFuncIdDirective'; did you mean 'EmitCVLocDirective'?
     Streamer->EmitCVFuncIdDirective(FuncId);
               ^~~~~~~~~~~~~~~~~~~~~
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:699:51: error: no matching function for call to 'llvm::MCObjectStreamer::EmitCVLocDirective(int&, int&, int&, int&, bool, bool, const char [1], llvm::SMLoc)'
                                  true, "", SMLoc());
                                                   ^
In file included from /llvm/tools/llilc/lib/ObjWriter/typeBuilder.h:15:0,
                 from /llvm/tools/llilc/lib/ObjWriter/objwriter.h:22,
                 from /llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:16:
/llvm/include/llvm/MC/MCObjectStreamer.h:125:8: note: candidate: virtual void llvm::MCObjectStreamer::EmitCVLocDirective(unsigned int, unsigned int, unsigned int, unsigned int, bool, bool, llvm::StringRef)
   void EmitCVLocDirective(unsigned FunctionId, unsigned FileNo, unsigned Line,
        ^~~~~~~~~~~~~~~~~~
/llvm/include/llvm/MC/MCObjectStreamer.h:125:8: note:   candidate expects 7 arguments, 8 provided
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp: In member function 'void ObjectWriter::EmitCVUserDefinedTypesSymbols()':
/llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:723:37: error: 'SymbolKind' was not declared in this scope
     Streamer->EmitIntValue(unsigned(SymbolKind::S_UDT), 2);

I found that, ObjWriter with ObjectWriter branch seems to require latest llvm version from upstream, not MS branch as described in the llilc documentation. With upstream I get only 2 errors:

llvm/tools/llilc/lib/ObjWriter/objwriter.cpp: In member function ‘int ObjectWriter::EmitSymbolRef(const char*, RelocType, int)’:
llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:358:66: error: no matching function for call to ‘llvm::MCObjectStreamer::EmitValueImpl(const llvm::MCExpr*&, int&, llvm::SMLoc, bool&)’
   Streamer->EmitValueImpl(TargetExpr, Size, SMLoc(), IsPCRelative);
                                                                  ^
In file included from llvm/tools/llilc/lib/ObjWriter/typeBuilder.h:14:0,
                 from llvm/tools/llilc/lib/ObjWriter/objwriter.h:22,
                 from llvm/tools/llilc/lib/ObjWriter/objwriter.cpp:16:
llvm/include/llvm/MC/MCObjectStreamer.h:95:8: note: candidate: virtual void llvm::MCObjectStreamer::EmitValueImpl(const llvm::MCExpr*, unsigned int, llvm::SMLoc)
   void EmitValueImpl(const MCExpr *Value, unsigned Size,
        ^
llvm/include/llvm/MC/MCObjectStreamer.h:95:8: note:   candidate expects 3 arguments, 4 provided
At global scope:
cc1plus: error: unrecognized command line option ‘-Wno-covered-switch-default’ [-Werror]

I found that need some special patch https://reviews.llvm.org/D15334?id=42315#0f5402b0 or a similar patch from the MS branch for this. But all this seems rather confusing ;-) I hope there is a simpler instruction for this.

@tijoytom-zz
Copy link
Contributor

Checkout ObjectWriter branch and apply this LLVM patch https://reviews.llvm.org/D29483
This is enough to build it , i tried it last week .

@BredPet
Copy link
Contributor

BredPet commented Jun 6, 2017

It was possible to compiler arm32 version. I just thought there was a valid LLVM repository with all needed patches already. Ok, thanks

@tijoytom-zz
Copy link
Contributor

@BredPet Can this be closed?

@alpencolt
Copy link

Checkout ObjectWriter branch and apply this LLVM patch https://reviews.llvm.org/D29483
This is enough to build it , i tried it last week .

@tijoytom does it work now? I've tired different combinations of branches but cant build x86 version.
Could you share which branches and commit you use? cmake command for configuration as well.

@sandreenko
Copy link

@tijoytom does it work now? I've tired different combinations of branches but cant build x86 version.
Could you share which branches and commit you use? cmake command for configuration as well.

The last object writer was published with this llvm version https://github.com/llvm-mirror/llvm
d98023490266477bc565b17952ac926b9e07c2ed + patch. We are trying to keep this information in update LLVM PRs(dotnet/llilc#1081).

What build errors do you see?

@alpencolt
Copy link

@sandreenko thank you I will try this commit.
Errors are may be different depending of configurations. If I use MS and ObjectWriter branches they are connected with changes from your PR:

-#include "llvm/Support/COFF.h"
+#include "llvm/BinaryFormat/COFF.h"

If I would revert this commit I will something like this:

[100%] Building CXX object tools/llilc/lib/ObjWriter/CMakeFiles/objwriter.dir/typeBuilder.cpp.o
In file included from /home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.cpp:11:0:
/home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.h:136:20: error: cannot declare field ‘UserDefinedTypesBuilder::TypeTable’ to be of abstract type ‘llvm::codeview::TypeTableBuilder’
   TypeTableBuilder TypeTable;
                    ^
In file included from /home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.h:13:0,
                 from /home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.cpp:11:
/home/alexander/src/llvm/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h:26:7: note:   because the following virtual functions are pure within ‘llvm::codeview::TypeTableBuilder’:
 class TypeTableBuilder {
       ^
/home/alexander/src/llvm/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h:55:21: note: 	virtual llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeRecord(llvm::StringRef)
   virtual TypeIndex writeRecord(llvm::StringRef record) = 0;
                     ^
/home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.cpp: In constructor ‘UserDefinedTypesBuilder::UserDefinedTypesBuilder()’:
/home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.cpp:18:26: error: no matching function for call to ‘llvm::codeview::TypeTableBuilder::TypeTableBuilder(llvm::BumpPtrAllocator&)’
       TargetPointerSize(0)
                          ^
In file included from /home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.h:13:0,
                 from /home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.cpp:11:
/home/alexander/src/llvm/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h:32:3: note: candidate: llvm::codeview::TypeTableBuilder::TypeTableBuilder()
   TypeTableBuilder();
   ^
/home/alexander/src/llvm/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h:32:3: note:   candidate expects 0 arguments, 1 provided
/home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.cpp:20:5: error: ‘VFTableShapeRecord’ was not declared in this scope
     VFTableShapeRecord vfTableShape(TypeRecordKind::VFTableShape);
     ^
/home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.cpp:21:38: error: ‘class llvm::codeview::TypeTableBuilder’ has no member named ‘writeKnownType’
     ClassVTableTypeIndex = TypeTable.writeKnownType(vfTableShape);
                                      ^
/home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.cpp:21:53: error: ‘vfTableShape’ was not declared in this scope
     ClassVTableTypeIndex = TypeTable.writeKnownType(vfTableShape);
                                                     ^
/home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.cpp: In member function ‘void UserDefinedTypesBuilder::EmitTypeInformation(llvm::MCSection*)’:
/home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.cpp:49:17: error: ‘class llvm::codeview::TypeTableBuilder’ has no member named ‘empty’
   if (TypeTable.empty())
                 ^
/home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.cpp:55:13: error: ‘class llvm::codeview::TypeTableBuilder’ has no member named ‘ForEachRecord’
   TypeTable.ForEachRecord([&](TypeIndex FieldTypeIndex,
             ^
/home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.cpp: In lambda function:
/home/alexander/src/llvm/tools/llilc/lib/ObjWriter/typeBuilder.cpp:58:15: error: ‘class llvm::MCObjectStreamer’ has no member named ‘EmitBinaryData’
...

@alpencolt
Copy link

It helps!
For building I use:
llilc ObjectWriter branch and commit:

commit 8dc6363f625055be5c471f2c11d472b9b167ec32
Author: David Wrighton <davidwr@microsoft.com>
Date:   Wed Jun 21 18:27:52 2017 -0700

    Update nuspecs to .19

llvm master branch, commit:

commit d98023490266477bc565b17952ac926b9e07c2ed
Author: Zachary Turner <zturner@google.com>
Date:   Thu Jun 22 17:43:15 2017 +0000

    Silence warnings about hidden virtual methods.
    
    Patch by Sergey Andreenko.
    Differential Revision: https://reviews.llvm.org/D34429
    
    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306038 91177308-0d34-0410-b5e6-96231b3b80d8

and patch https://reviews.llvm.org/D29483

@sandreenko is it possible to keep this information somewhere in project documentation? I can prepare PR but don't appropriate place.

@BredPet
Copy link
Contributor

BredPet commented Nov 2, 2017

After the latest achievements #4856 we would like to clarify the situation with this main component.
This is very important for us, we need to decide on further support for this component.

I. What is the current ObjWriter status, near future? The project looks abandoned. Can any other component be used instead? What are your thoughts on this, if possible, share the details.

II. We need to integrate arm and cross-x86 versions into the remote build so CoreRT can use them as well as in the case of x64 architecture. How can we do that?

III. Perhaps we need to separate this component as a separate repository so that it's more transparent and not in the LLILC tree as it's now. We understand that it depends on the LLILC and LLVM, but they don't seem to be supported now, too.

@Dmitri-Botcharnikov
@sergign60
@alpencolt
@tijoytom, @sandreenko, @jkotas please take a look

@jkotas
Copy link
Member

jkotas commented Nov 2, 2017

I have commented on this here: #4589 (comment)

Perhaps we need to separate this component as a separate repository

Agree. Or just add it to this repository as I have mentioned in the comment (not building by default - having default build having dependency on LLVM would be too heavy weight).

We understand that it depends on the LLILC and LLVM

I should depend on LLVM only. There should not be any significant LLILC dependency.

@BredPet
Copy link
Contributor

BredPet commented Nov 3, 2017

@jkotas thanks for your comments, we will think about this and about integration ObjWriter into CoreRT.

@am11
Copy link
Member

am11 commented Nov 5, 2017

ObjWriter into CoreRT

@BredPet, yes please, that would be excellent! There were some files from CoreCLR as well that objwriter build was requiring, last time I tried. Based on @jkotas' comment, I believe it can be rewired to build independently or with corert sources.

Alpine x64, [glibc-]Linux x86 and future platforms/archs/libcs will also benefit from it if corert/build.sh is used to create objwriter's binaries and packages, which has all the supported Host/Build architectures and RIDs already wired up. Please let me know if I can contribute to speedup ObjWriter's llilc->corert port whenever this work is started. 8-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants