This is a patch that tries to enable something that is not usually possible in present design. If the patch looks a little weird bear with me. I want ideas on this issue and any workable solutions if any.
llvm-objdump with no triple or mcpu tries to infer the architecture based on
the details present in file. This works on most architectures and file formats except ET_ARM type object type. The presence of thumb if any is not indicated anywhere except in .ARM.attributes and using mapping symbols $t.* Also not all architectures have all instructions available. This makes the disassembly of ARM ELF full linked image that has thumb and ARM mix virtually useless. The objdump in its present state has only one disassembler and hence cannot make use of the above information. This commit will crack open the ELF binary if it is ET_ARM type and try to see CPU name and if it is thumb only processor. The tool will create a second disassembler for ARM ELF and try using that if the first one fails. The change also makes use of mapping symbols $a, $t. The mapping symbols will determine which disassembler should be used. This makes usage more user friendly as the CPU no longer needs to be explicit if the attributes are present in the file. If the attributes are not present, the usage remains the old way (using -mcpu and -triple options).