On 09/21/15 12:00, Suprateeka R Hegde wrote:
> Or could it be as follows?
>
> Going by the existing convetions, "Elf*_Word" seems to mean the "Full Integer" size for that model.
>
> Based on the famous 64-bit programming model -- LP64, the full integer is still 32 bits. And hence Elf64_Word is also 32 bits. And for all the 64 bit support, we have Elf64_Xword or Elf64_Sxword.
>
> Or in other words, it might be just a naming convetion:
> Elf32_Word means size of Full Integer on ILP32 model.
> Elf64_Word means size of Fulll Integer on LP64 model.
>
> However, the confusion is still there for other modles as the gABI document specifies the size too. If the size was not specified and only the type was specified, then each model could gets its own meaning.
>
> In that way, as Ali said, Elf_Word might have been enough and that would mean whatever is the size of full integer on that model. For this to happen, we should remove the size attribute and just keep the type.
It is, as you suggest, a naming convention. Elf*_Word
means simply, the definition of Word applicable to ELFCLASS*.
It does not mean "full integer" or anything like that, which
is why the gABI also specifies the size.
The fact that Elf64_Word is a 32-bit value was a well understood and
intentional decision made when ELFCLASS64 was defined, and not one
that can be reasonably changed now. I was speculating about other
ways this might have been defined, but I shouldn't have because it's
history, and it's done, and really, it's fine.
I should have just said: Elf64_Word is the right type to use
in defining Elf64_Chdr, because it's the ELFCLASS64 Word
type, and as it's defined to be a 32-bit integer, will have
the desired effect on structure layout.
Thanks...
- Ali