bitwiseworks / gcc-os2

Port of GCC compiler to OS/2
GNU General Public License v2.0
16 stars 2 forks source link

Suport ELF as object format #12

Open dmik opened 4 years ago

dmik commented 4 years ago

Currently, GCC for OS/2 compiles sources into a.out object files. Which are then converted to OMF with emxomf.exe and linked to an OS/2 LX executable (EXE or DLL) using wlink from OpenWatcom or ilink from IBM VisualAge C (not actually suitable for modern C++ and therefore not supported by us, mainly because it's very dead).

Such a pipeline has many drawbacks. First, it's very slow as includes a separate step of converting A.OUT to OMF. Second, A.OUT is very old and is not suitable for some applications per se. See #11 for one example. Third, there are lots of limitations on the debug information in both A.OUT and OMF (both are very old).

We need to find a way to link ELF objects to LX executables. Then we will be able to configure GCC so that it will generate ELF on OS/2 and we are done. There are rumors that wlink already supports linking ELF to LX. This needs checking.

dryeo commented 4 years ago

There is objconv, https://www.agner.org/optimize/#objconv which can convert elf to omf, obj files and libraries. There is http://www.os2site.com/sw/dev/gcc/misc/elfomf.zip for which the source sadly seems to be lost and also XFree86 has an elf loader in the xserver so we could directly load Linux video modules, needed gcc-elf to build. Knut might know more about elfomf.

dmik commented 4 years ago

@dryeo thanks for the info. OTOH, converting ELF to OMF kinda beats the whole purpose. We will lose all ELF benefits we need. The only way to go here is link ELF directly to LX (or provide an ELF loader to avoid the LX stage at all — this is where Knut's work could be useful I guess).

Anyway, there is no plans to work on that any time soon. Low priority.

ydario commented 4 years ago

Also Odin WIN32K.SYS driver is able to load directly ELF executables; unfortunately the driver works with older kernels, it misses alignment required to use newer kernels.