Small notice about errors handling in elf.library
Posted: Wed Jun 22, 2011 11:13 am
Dunno if i should post it to SDK sub-forum, or to general one (so i choice general one, but if it will fits better in SDK subforum , plz move it).
So, we have found back in time some small problem related to handling of errors of elf.library.kmod.
When elf binary have some unsupported reloc, aos spawn a window, with words "reloc #xxx is unsupported". And that XX value are not the same as in the elf specification. For example, when we have UNKNOWN_RELOC_36 (when binary compiled with enabled TLS), and by ELF specification, reloc 36 are R_PPC_SECTOFF - its not valid on aos4, because its reloc_72 by elf specification what mean R_PPC_TPREL16.
In other words, when developer see a window with error indication, he of course can't know that 36 its not 36, but 72.
That was founded with help of Frank Walle , who have old version of elf.library, in which: R_PPC_SECTOFF_HA is the last relocation which is known by name to elf.library (although unsupported). All the following relocations are called "Unknown_n" with n starting at 1! Yes, that means Unknown_1 is relocation #37 and Unknown_36 would be relocation #72 (R_PPC_TPREL16).
Will be cool if all the names will be included to os4 elf handler, and they will report the correct numbers of errors (and if some of them not supported, just skip them, but make final error report valid to elf specification).
Not big deal of course, but can drive to big troubles some developers who did't know that.
So, we have found back in time some small problem related to handling of errors of elf.library.kmod.
When elf binary have some unsupported reloc, aos spawn a window, with words "reloc #xxx is unsupported". And that XX value are not the same as in the elf specification. For example, when we have UNKNOWN_RELOC_36 (when binary compiled with enabled TLS), and by ELF specification, reloc 36 are R_PPC_SECTOFF - its not valid on aos4, because its reloc_72 by elf specification what mean R_PPC_TPREL16.
In other words, when developer see a window with error indication, he of course can't know that 36 its not 36, but 72.
That was founded with help of Frank Walle , who have old version of elf.library, in which: R_PPC_SECTOFF_HA is the last relocation which is known by name to elf.library (although unsupported). All the following relocations are called "Unknown_n" with n starting at 1! Yes, that means Unknown_1 is relocation #37 and Unknown_36 would be relocation #72 (R_PPC_TPREL16).
Will be cool if all the names will be included to os4 elf handler, and they will report the correct numbers of errors (and if some of them not supported, just skip them, but make final error report valid to elf specification).
Not big deal of course, but can drive to big troubles some developers who did't know that.