nexos wrote:
Now, I will say that Intel would have made our lives easier if they chose ELF. But I don't think that's morally wrong.
oh, come on! I understand - UNIX fanboying and all, but have you tried to get through "dynamic linking" mess of ELF? in those specs, scattered through processor specific and not so specific pieces, those broken pdfs from 90s?... that would be exactly what UEFI should have dealt with if they chose this dumbass format. because your loader is a dynamically loaded executable object - if it is position dependent, then they should use a format, providing a decent and easy to use mechanism for fixups, what PE does. or, it should be quazi-PIC with all the consequences. Just read that freaking 5 chapter of Sys V ABI and you quickly understand why Intel has done so goooooood, picking PE.
nullplan wrote:
I do find it fair to say that UEFI was designed with MSVC in mind (that's why the binary format is PE and the calling conventions are the MS ones, as that is the only thing MSVC is capable of generating, at least to my knowledge), and that clang works is just a happy little accident. Without definitive data, this is merely speculation, of course, but you have also offered no counter argument.
no no no, his quote was this:
not banned yet bzt wrote:
Correction: UEFI was written with purely MSVC in mind, not C in general
see, it's not about format chosen, function naming style etc. it's a statement, about UEFI was not made for the C programming language, but for some MSVC C, which bzt has in its rich imagination. and this was what made me reply the way I did, because that statement was ... "extreme bullshit", as named.
as or the format chosen, ABI etc - it has nothing to do with C, as you probably know. it's up to compilers what targets to support. if GCC doesn't want to provide a decent PE targetting, because of religious reasons, it doesn't make UEFI "made for MSVC only and not for C in mind". You wouldn't seriously tell, that if names in UEFI follow Windows style, it makes the spec "MSVC and not C", wouldn't you?
and now, finally, the interesting part.
PS. personally, just for the sake of completeness, I compiled my UEFI OS Loader with clang too. For ARM32 and ARM64[1]. And it worked. heck, I even compiled the code for RISCV64! Just need to finish my ELF->PE conversion utility to try it out! yep, clang can't make PE targets for RISCV.
I managed to write that simple ELF->PE converter and my loader worked on RV64 qemu virt machine!
too bad, there is no GOP in uboot yet to show graphical cuteness, but it works as supposed. btw, nexos, writing this utility, I had to learn ELF internals a bit. again - Intel wouldn't make our lives easier, choosing ELF, trust me.
I say opposite - mainstream compiler writers would make our lives easier if stopped being stubborn p\/ssies and made bare PE a first class target.
So, clang targetting bare metal ELF, generated a valid code for my UEFI loader. after I converted it into PE, it worked. so is it also just a "happy coincidence", nullplan? note, for ARM and ARM64, you may say, clang mimicked MSVC, but here, with RV64, it couldn't! so what "definitive data" you need yet for approving them as a "counter argument" to that absolutely clownish statement? if there was a need to counter argument that in the first place.
here, is my lil loader, showing signs of presence on RV64 recorded in a clumsy video. ^_^