Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Paul Smedley

Pages: 1 2 [3] 4 5 ... 60
31
Multimedia / Re: Updated Uniaud32 build
« on: May 27, 2021, 11:38:27 am »
https://smedley.id.au/tmp/uniaud32-linux-5.10.40-20210527.zip - code updated to linux 5.10.40 level...

32
Quick update, with https://smedley.id.au/tmp/gcc-11.1.0-os2-coff-20210522.zip - I can compile and link *C* executables with assembly produced in the COFF format. (For ELF, we have a bug with wl.exe preventing a valid executable being created).

Note c++ executables can't currently be linked. This is because weakld.c (part of emxomfld) only understand OMF, so I have currently commented out weak_prelink() in emxelfld, so we don't have weak symbols support.

For weakld,  https://github.com/bitwiseworks/libc/blob/master/src/emx/src/emxomf/weakld.c in WLDAddObject() will need to be enhanced so it understands coff (and eventually ELF).

33
FWIW the example helloworld.o in coff format, as as-coff.exe is at https://smedley.id.au/tmp/helloworld-coff.zip

34
Hi All,

Yet, you probably know more then most of us, if only from hacking on the GCC source. There are people who seem to instinctively understand this stuff though, AZ who did the GCC 2.9x ports was one. IBM chased him down and payed him to do the first kLIBC GCC port, 3.22 or so for Mozilla. There was someone else who ported GCC back in the day for fun, a different port then EMX. So much software lost.

Just an update on this - the issue with OS/2 executables and elf format object files appears to be a wl (Watcom Linker) bug. I built as.exe with coff object format and a simple hello world executable runs ok.

I'll use this to continue with some tweaks to gcc and emxelfld.exe as time permits, to see what's possible - ie can we still build a DLL with the tools and whatever other changes may be required.

Cheers,

Paul.

35
Hey Dave,

Need a compiler expert who understands all these segments and stuff.

That rules me out then :P

Cheers,

Paul

36
Hey Dave,

Perhaps rebuild libend with those symbols commented out?
I tried but I seem to be missing the ml assembler and building all fails due to missing demangle.h
Looking, it seems they're reserved symbols when the option DOSSEG is specified. Where it is getting specified, I'm not sure unless it is automatic when making an executable. It is possible to override the segment ordering, only recommended for embedded applications without an OS. The segments probably should be ordered in a specific order. Search for DOSSEG in the Open Watcom Linker guide.
Looking at the emxomfld source, I can't quite figure out the whole list of options being passed and why linking OMF doesn't cause the same error.

Yeah I tried rebuilding libend with those symbols commented out - it now links but I get the same SIGILL as if I just remove libend.

I think I was confused when I thought it was working the other day - my hello.lnk had helloworld.obj in it - which was an OMF version of the object file :(

37
'tis weird, this worked the other day, today I'm getting the
Code: [Select]
Error! E2026: redefinition of reserved symbol _edata
Error! E2026: redefinition of reserved symbol __edata
Error! E2026: redefinition of reserved symbol _end
Error! E2026: redefinition of reserved symbol __end

Removing libend 'fixes' the linking - but I get a SIGILL trying to run the resulting executable...

38
Removing libend.lib from the linking step allows an executable to be created, but running it gives:
Killed by SIGILL
pid=0xf202 ppid=0x776e tid=0x0001 slot=0x009d pri=0x0200 mc=0x0001 ps=0x0010
U:\DEV\T\HELLOWORLD.EXE
HELLOWOR 0:00000024
cs:eip=005b:00010024      ss:esp=0053:00027f6c      ebp=00027f88
 ds=0053      es=0053      fs=150b      gs=0000     efl=00012206
eax=00000000 ebx=00027f90 ecx=1c8dc060 edx=1c8dc068 edi=00000000 esi=00000000
Process dumping was disabled, use DUMPPROC / PROCDUMP to enable it.

39
Status:

Minor tweaks to GCC made to always invoke emxelfld as the linker.

- emxelfld.c forked from emxomfld.c (copy at https://smedley.id.au/tmp/emxelfld.c)
- emxomfld checkomf function modified to also check for elf header and not attempt to convert it to OMF - we want the autoconvert code as we may be trying to link against an a.out library or object file (eg crt0.o)
- emxomfld - don't call weak_prelink() (as weakld doesn't understand elf)


Currently failing to link an executable with:
gcc -Zexe -Zomf -o hello.exe helloworld.c
Error! E2026: redefinition of reserved symbol _edata
Error! E2026: redefinition of reserved symbol __edata
Error! E2026: redefinition of reserved symbol _end
Error! E2026: redefinition of reserved symbol __end

This is similar to the error Dave was getting earlier with wl.exe - more investigation required....

TODO: (other than fix linked an exe)
- Update as_elf to something more modern than binutils 2.9.1
- work out how to workaround the lack of elf support in emximp - in order to create import libraries for DLL's - worst case is to use OMF libs

40
Hi All,

I still think that emxomfld could be stripped down by not converting and bypassing the weak linker to call wl.exe. This may also result in needing the minimum changes to GCC.

I'm still thinking about how best to handle it. We may still WANT to convert to OMF in some cases in order to use the 'classic' debuggers.

Of course, switching to ELF may make gdb easier to compile/work.

Just thinking out load, I was considering introducing -Zelf to tell GCC to invoke as_elf.exe rather than as.exe - that also opens up the use of -Zelf -Zomf to use ELF initially, but convert to OMF at link time (if we have a suitable ELF -> OMF converter that makes the exercise worthwhile).

I'll probably hack something together short term and make sure that 'stuff' works, then think about how best to support a.out, elf & OMF object formats in a more flexible manner...

Thinking some more.... I think I'll fork emxomfld.c and create an emxelfld.c which will do the following:
- use wlink by default
- use noautocnv by default to ensure we don't try and convert elf to OMF

This should make it easy to add -Zelf to gcc which would use emxelfld.exe as the linker

The bit I haven't worked out yet is how to tell gcc to use as_elf.exe not as.exe

It may be that the gcc elf needs to be a completely separate install to gcc aout/omf

41
@os4user I'm not disagreeing with you, but if we don't convert to omf, how do we debug on OS/2?

42
Hey Dave,

I still think that emxomfld could be stripped down by not converting and bypassing the weak linker to call wl.exe. This may also result in needing the minimum changes to GCC.

I'm still thinking about how best to handle it. We may still WANT to convert to OMF in some cases in order to use the 'classic' debuggers.

Of course, switching to ELF may make gdb easier to compile/work.

Just thinking out load, I was considering introducing -Zelf to tell GCC to invoke as_elf.exe rather than as.exe - that also opens up the use of -Zelf -Zomf to use ELF initially, but convert to OMF at link time (if we have a suitable ELF -> OMF converter that makes the exercise worthwhile).

I'll probably hack something together short term and make sure that 'stuff' works, then think about how best to support a.out, elf & OMF object formats in a more flexible manner...

Cheers,

Paul.

43
Thanks everyone... what works here is:

Code: [Select]
gcc -S helloworld.c
as_elf helloworld.s -o helloworld.o
wl @hello.lnk
** EXPERIMENTAL (HLL) ** Open Watcom Linker Version 2.0beta1 Limited Availability by SHL on Jul  2 2020
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
loading object files
searching libraries
creating map file
creating an OS/2 and ArcaOS executable

For interest - https://smedley.id.au/tmp/helloworld.zip

I have a day off on Friday, I'll try and think about how to modify GCC to use this stuff....

Cheers,

Paul

44
Anyone know how to use wlink to create an executable from the command line?

Using:
wlink option quiet name helloworld.exe file helloworld.obj library libc_dll.lib

gives:
Code: [Select]
Error! E2028: ___main is an undefined reference
Error! E2028: _printf is an undefined reference
Warning! W1014: stack segment not found
Warning! W1023: no starting address found, using 0001:00000000
file helloworld.obj(helloworld.obj): undefined symbol ___main
file helloworld.obj(helloworld.obj): undefined symbol _printf

Cheers,

Paul

45
Programming / Re: Updated GCC Builds
« on: May 10, 2021, 05:07:10 am »
Hi Dave,

Well, that did fix the crash here.

Well that kinda sucks - the intent was to identify why it's crashing - looks like it's some kind of optimisation issue then....

Cheers,

Paul.

Pages: 1 2 [3] 4 5 ... 60