Small notice about errors handling in elf.library

A forum for general AmigaOS 4.x support questions that are not platform-specific

Small notice about errors handling in elf.library

Postby kas1e » 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.
kas1e
Beta Tester
Beta Tester
 
Posts: 481
Joined: Sat Jun 18, 2011 8:56 am

Re: Small notice about errors handling in elf.library

Postby Hans-Joerg Frieden » Wed Jun 22, 2011 5:27 pm

Hmm, weird... I thought I already did that, I know there is an array with reloc names in the library. Thanks for bringing it up, I'll check it.
NOTICE: If you want to contact me, use E-Mail. I cannot be contacted via the forum/private messages anymore
User avatar
Hans-Joerg Frieden
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 223
Joined: Wed Dec 08, 2010 4:52 pm

Re: Small notice about errors handling in elf.library

Postby kas1e » Wed Jun 22, 2011 7:53 pm

@Hans-Joerg Frieden

Thanks for worring. Maybe it just fixed already in current beta-version, but not in the public update2 ?

Btw, as an idea: maybe will be not bad to add a bit more info for error, like for example Unsupported Reloc #XX (name_of_reloc_here). For now its just saying Unsupported Reloc #XX, and developer need to found name of reloc in the elf specification, but if add name of relococation itself (not only number) to the error message itself, then it will be twice better :)
kas1e
Beta Tester
Beta Tester
 
Posts: 481
Joined: Sat Jun 18, 2011 8:56 am

Re: Small notice about errors handling in elf.library

Postby Hans-Joerg Frieden » Wed Jun 22, 2011 8:22 pm

kas1e wrote:@Hans-Joerg Frieden

Thanks for worring. Maybe it just fixed already in current beta-version, but not in the public update2 ?

Btw, as an idea: maybe will be not bad to add a bit more info for error, like for example Unsupported Reloc #XX (name_of_reloc_here). For now its just saying Unsupported Reloc #XX, and developer need to found name of reloc in the elf specification, but if add name of relococation itself (not only number) to the error message itself, then it will be twice better :)


Well, the "Unsupported Reloc" error is a weird thing to happen, because even a malfunctioning program should be able to be relocated. If you have one of these, then there is something very wrong and I doubt that any more information will help; mostly, it's a corrupt binary.
NOTICE: If you want to contact me, use E-Mail. I cannot be contacted via the forum/private messages anymore
User avatar
Hans-Joerg Frieden
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 223
Joined: Wed Dec 08, 2010 4:52 pm

Re: Small notice about errors handling in elf.library

Postby kas1e » Wed Jun 22, 2011 8:31 pm

Well, the "Unsupported Reloc" error is a weird thing to happen, because even a malfunctioning program should be able to be relocated. If you have one of these, then there is something very wrong and I doubt that any more information will help; mostly, it's a corrupt binary.


Yeah, sure. I only meet with it 1 time and it was reloc36 (in reality 72), which was in the binary because i compiled code with enabled TLS. I also know that other developer (Jaokim, who works on jamiga2), also meet with it one time (with the same reloc36 (72) , and because of the same enabled TLS). Sure, its not very offten to meet with those errors, but it happens. Full and understanable error handling of any possible case are always good, because everything can happens :)
kas1e
Beta Tester
Beta Tester
 
Posts: 481
Joined: Sat Jun 18, 2011 8:56 am


Return to General AmigaOS

Who is online

Users browsing this forum: No registered users and 4 guests

cron