12 May 2024, 14:28 | #341 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
Ok, apparently before AmigaOS 4.0 there was no standard library, and instead there was libnix, ixemul, Lattice/SAS C, Aztec C, DICE C - all incompatible. And then somehow newlib.library came along (presumably from whoever owns AmigaOS) and created a standard (and maybe that standard was backported to earlier versions of AmigaOS?). I'm happy to work to a standard - but I want to have a mini-clone of that. The clone will be strictly C90. Apparently there is also a clib2/clib4 that is presumably a moving target, and has a different goal (POSIX) to what I am interested in (C90 - and yes, I'm aware that POSIX is a superset of C90 - I'm not interested in the superset at all). Can anyone briefly describe how newlib works? ie I am familiar with the registers on entry to an Amiga program (d0 and a0) and I know how to start at address 4 in memory and scan for libraries. But once I find newlib.library I do ... what? I assume there is a large structure containing every C90 function, plus some POSIX functions, and I just call whichever one I want. (that's what I do in PDOS-generic too, except the structure pointer is given as a stack parameter). Thanks. Paul. |
|
12 May 2024, 14:54 | #342 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
Unless I'm missing something, it's just a little bit of "glue" code required whenever someone comes up with a new version. Unless the function calling convention (registers/stack) changes. I need consistency there. At least for functions with a variable number of parameters - like printf. Then you should be able to pull out your old SAS/C compiler, build a small executable that does hello world or whatever, and then run it on my 68000 ELF executable under 68000 Linux/BSD or qemu-m68k wherever that runs. You won't be able to run the SAS/C compiler itself under my clone though, as it likely uses non-C90 functions. |
|
12 May 2024, 17:58 | #343 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,250
|
Quote:
|
|
12 May 2024, 18:49 | #344 | |||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
Quote:
Quote:
So the calling convention will be dictated by the existing standard gcc 3.2.3 as I haven't changed the calling convention. But if there is an existing library (in the linked list) that uses the same calling convention as gcc 3.2.3, then I can clone that (all of the ones that use that convention, most likely). And some news - pdld has been updated to take hunk object and produce ELF output - but not relocations yet. That may or may not be good enough for qemu-m68k to work - will test in due course. Source is around here: https://sourceforge.net/p/pdos/gitco...dld/src/hunk.c |
|||
12 May 2024, 19:37 | #345 | ||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,250
|
Quote:
Quote:
Amiga link libraries use whatever convention was used when the library was compiled, so it has to match the compiler configuration. |
||
13 May 2024, 01:03 | #346 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,510
|
Quote:
So you would have to emulate their functions, which requires a lot more than "glue" code to some clib routines. You would probably end with something like "vamos" (virtual AmigaOS runtime): https://github.com/cnvogelg/amitools.../docs/vamos.md |
|
13 May 2024, 01:30 | #347 | |||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
I do not give applications the ability to call either Write() or write(). They get C90. Nothing more, nothing less. Quote:
Do none of the libraries - ix, SAS/C - use the cdecl convention in their dynamic libraries? Quote:
Also, I have now had a chance to test the pdld output - it is generating LSB headers instead of MSB, which my loader (which the author tested against) is willing to accept, but qemu-m68k isn't, so I am waiting for him to update it to generate MSB. |
|||
13 May 2024, 03:11 | #348 | ||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,250
|
Quote:
Quote:
Varadic functions on Amiga typically pass a pointer to a stack frame in a register - or to put it differently, the dos.library implements something like VPrintf(), and the compiler does the rest of the magic to provide you Printf() from that function (which is not really complicated). Look up the include file for pramgas/dos.h to find out how the gcc handles this, there is surely something. |
||
13 May 2024, 03:54 | #349 | ||||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
I guess I am more interested in letting gcc set the ABI. There are compromises when using msvcrt.dll too - e.g. it isn't actually documented. Quote:
Quote:
Quote:
Ok, so based on what you have told me, it seems that what I want doesn't already exist on the 68000, so I will create my own msvcrt.library - unless there is a barrier to installing it. BFN. Paul. |
||||
13 May 2024, 04:09 | #350 |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
|
13 May 2024, 08:20 | #351 | |
Ex nihilo nihil
Join Date: Oct 2017
Location: CH
Posts: 4,944
|
Quote:
The power of names in success is not to be underestimated |
|
13 May 2024, 08:34 | #352 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
|
|
13 May 2024, 08:57 | #353 |
Ex nihilo nihil
Join Date: Oct 2017
Location: CH
Posts: 4,944
|
^ "pipping out" looks good
|
13 May 2024, 09:28 | #354 |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
I forgot to mention ARM32 and ARM64 too.
I have made the changes required so that PdAndro: https://play.google.com/store/apps/d...ro&hl=en&gl=US is now a mini clone of Win32 ARM (Windows 11 for ARM still supports that - but maybe not for long). It's still waiting for the APK to be updated with the new bios.exe. I'm actually doing the 68k stuff now to take a break from that work which drained me (issues with floating point - still not resolved). And I'll be doing the same for Win64 ARM. Also the 68k is basically giving closure to what I wanted to do all along - move from x86 to 68k. I'm still resolving "MSDOS best practices" to ensure that the move could have been made (ie proving that C90 was viable all along). So the movement to ARM is the modern-day equivalent. |
13 May 2024, 09:40 | #355 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
This made me pause for some time to remember how I managed on msvcrt.dll. While standard mingw produces executables that use more than just msvcrt.dll, I instead use it (or my replacement) in conjunction with PDPCLIB. And PDPCLIB limits itself to just msvcrt.dll. So SAS/C would probably need to be the same - compile with SAS/C, link with PDPCLIB (PDPCLIB targeting SAS/C dynamic library - although it sounds like it doesn't exist). And then you may use the SAS/C dynamic library (if it exists) or you may use my replacement for the SAS/C library (just as PDPCLIB builds into a (mini/subset) replacement for msvcrt.dll). With regarding exec and dos libraries - I'm not sure what of them will be required - but I will be starting with cloning them anyway, to support my existing statically-linked binaries. |
|
13 May 2024, 10:19 | #356 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
https://aminet.net/package/util/libs/ixemul-48.0 ie it actually exists. And so is the closest thing to msvcrt.dll And I will only clone the C90 functions from that. I assume that has the full C90 library in it. |
|
13 May 2024, 10:22 | #357 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
Which will be fine so long as you link with PDPCLIB (which I will). |
|
13 May 2024, 10:43 | #358 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
So I expect to be using ixemul.library as the name. And if you don't already have the existing ixemul.library installed, you can install mine instead - but either will work - for the limited goal of running D7-conforming, C90-conforming, ixemul-subset-conforming programs (ie in practice your only choice will be gccami + PDPCLIB to start with). And if you use my bios.exe mini Amiga clone, you don't actually need a real ixemul.library to exist at all, as it is built-in to the Linux executable, with the C library recursively called (that's how my Win32 clone works already). |
|
13 May 2024, 10:47 | #359 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,250
|
Not sure what you mean? You can surely add the SAS/C linker libraries to your projects if you own SAS/C. If you don't, then you cannot. Remember that SAS/C is a commercial product. (Or rather "was"). Or is the idea to create a custom link library based on the SAS/C interface and let users link to that for SAS/C built object code and by that redirect C90 stdio to your layer.
|
13 May 2024, 10:56 | #360 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
No, I mean - I have this code: library = (struct Library *)SysBase->LibList.lh_Head; while (library != NULL) { if (strcmp(library->lib_Node.ln_Name, "dos.library") == 0) { DOSBase = library; break; } library = (struct Library *)library->lib_Node.ln_Succ; } so now I am expecting a ixemul.library to exist (given that no sasc.library appears to exist), and I don't want it to be the normal ixemul.library - I may wish to start with a clean system (on a genuine Amiga 500 - or 2500 to start, as PDPCLIB currently needs 68020 and FPU until I get more code) and install my own ixemul.library. ie I assume I don't need to jailbreak my Amiga 500/2500. I assume there is no "signing" required. I assume there is not a limit of the number of shared libraries I am allowed to install. I assume names aren't restricted to ones that Commodore has sanctioned - that sort of thing. So I am free to plonk in an msvcrt.library or ixemul.library (expecting to use the latter name), and the above while loop will find it if it is installed? |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|