Setting the OSType in the ArchSpec triple is needed to correctly setup up
the register context plugin. ArchSpec::SetArchitecture, for Mach-O only, sets
the OSType. For ELF it was left to the ObjectFileELF to fill in the missing
OSType.
This change moves the ObjectFileELF logic into ArchSpec.
A new optional 'os' parameter has been added to SetArchitecture.
For ELF, this value is the from the ELF header.e_ident[EI_OSABI].
The default value is 0 or ELFOSABI_NONE.
The real work of determining the OSType was done by the ObjectFileELF
helper function GetOsFromOSABI. This logic has been moved SetArchitecture.
GetOsFromOSABI has been commented as being deprectated.
It is left in to support asserts.
For ELF the vendor value returned from SetArchitecture should be UnknownVendor.
An unneeded resetting in ObjectFileELF has been removed and replaced with
an assert.
This fixes a problem reading a core file on FreeBSD/ARM because the spec triple
was arm-unknown-unknown
After this line can you make sure that if the OS or vendor is unknown that it is left as an unspecified unknown?
If the above assert asserts when you run this, you will need to do one of:
This will clear the name, but leave the enum value as UnknownOS or UnknownVendor.
This will make sure that any "unknown" values are said to be "unspecified unknowns" so that the arch will effectively be one of
If the triple contains "unknown" as the string value in their triple, plug-ins won't be able to wildcard match the ELF file when needed. See the implementations of ArchSpec::TripleVendorWasSpecified() and ArchSpec::TripleOSWasSpecified() to see how we do this, but a quick sum is if the triple has a enum value of unknown and no string value, it is a "unspecified unknown" and if the enum is unknown and the string value is "unknown" then is is a "specified unknown". Some plug-ins will match the specified unknown values and also allow wildcard matching when the unknown isn't specified. It would be nice to eventually have llvm::Triple support for "none" for both the OS and vendor so we can specifiy "no OS" and "no vendor" for things like baseboard binaries, but right now we use "specified unknown" as the marker for "no OS" and "no vendor".