Hi Linaro Toolchain Group,
I am going through the binutils code base specific to arm & aarch64. Please give some insight on below questions.
1. In the struct bfd_arch_info {...} (in bfd/bfd-in2.h) there are two fields 'enum bfd_architecture arch' and 'unsigned long mach'. I went trough the binutils porting guide (by MR.Swami.Reddy@nsc.com) which says 'arch' is for architecture & 'mach' is for machine value. At present in the bfd/bfd-in2.h :- arch = bfd_arch_aarch64 and mach = bfd_mach_aarch64 or bfd_mach_aarch64_ilp32. But what these fields really means ? What is the difference between 'arch' and 'mach'?
Lets say instruction set architecture is ARMv8 (also known as aarch64 for 64 bit- if I am not wrong). Then we have specific implementation of this like cortex53, cortex57, Cavium ThunderX etc. With respect to this what will be the value of arch = ? and mach = ?
2. In the include/opcode/arm.h the 'arm_feature_set' is defined as a structure where as in include/opcode/aarch64.h 'aarch64_feature_set' is defined as unsigned long. Is there any specific reason for this? Why structure definition was not followed in aarch64 ? typedef struct { unsigned long core; unsigned long coproc; } arm_feature_set;
typedef unsigned long aarch64_feature_set;
3. Also I see that in the case of arm, 'mach' values are derived from cpu extension value specified in that 'arm_feature_set' structure. For example. if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_cext_iwmmxt2)) mach = bfd_mach_arm_iWMMXt2; Whereas in aarch64 mach is derived based on API type (64 or 32). Any reason for this ? mach = ilp32_p ? bfd_mach_aarch64_ilp32 : bfd_mach_aarch64;
Thanks in advance.