Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add libnix? #5

Open
tehKaiN opened this issue Jun 2, 2020 · 8 comments
Open

Add libnix? #5

tehKaiN opened this issue Jun 2, 2020 · 8 comments

Comments

@tehKaiN
Copy link
Contributor

tehKaiN commented Jun 2, 2020

Hi there,

Due to recent developments of your extension, I'm trying to support both yours and Bebbo's GCC in my code.

To this point I've used stdio.h, string.h and other std headers excensively. I see that your implementation lacks lots of fns. Perhaps you could include https://github.com/bebbo/libnix (even the ks1.3+ variant) in your toolchain?

More regarding libnix: https://github.com/bebbo/amiga-gcc/wiki/Libraries

@BartmanAbyss
Copy link
Owner

Hi,
thanks for using my extension. The focus of my extension is more on demo & game development, these don't need a std lib.
As such, this is currently low on my list of priorities.
However, if you want to add it to the extension, I will accept a pull request if you get it working, and it's not enabled by default.

@tehKaiN
Copy link
Contributor Author

tehKaiN commented Jun 3, 2020

Yeah, and I'm developing a game engine/library/framework/whatever for classic Amigas since 2013 and have a bunch of games running with it. ;)

I've tried building libnix but don't have enough patience, so I've started rewriting my code. I've came up with tiny std library with functions which I use - they are not tested yet, because I'm getting some link errors:

undefined reference to `__muldi3'
undefined reference to `__clzsi2'
undefined reference to `__fixdfsi'
undefined reference to `__udivdi3'
undefined reference to `__ltdf2'
undefined reference to `__floatsidf'
undefined reference to `__muldf3'
undefined reference to `__subdf3'
undefined reference to `__adddf3'
undefined reference to `__divdf3'
undefined reference to `__gtdf2'
undefined reference to `__fixunsdfsi'
undefined reference to `__floatunsidf'
undefined reference to `__ledf2'
undefined reference to `__gedf2'
undefined reference to `__umoddi3'

Any idea how to work around that? The files are in the attachment - just paste them into project made from template and try to build.

ministd.zip

@BartmanAbyss
Copy link
Owner

You’re using floating point on a CPU with no FPU. You need to get these intrinsics from a m68k GC support library I guess.
I have only included mulsi3, divsi3, modsi3, etc. in gcc8_support.s

@tehKaiN
Copy link
Contributor Author

tehKaiN commented Jun 3, 2020

Not all are float related. See https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html . I can work around those missing float routines, but there are others, which are quite useful:

  • __muldi3 is ULONG = ULONG*ULONG,
  • __udivdi3 is ULONG = ULONG / ULONG
  • __umoddi3 is ULONG = ULONG % ULONG

I know they are not present in 68000 assembly, but are quite often used. Could you consider implementing at least those?

@BartmanAbyss
Copy link
Owner

You can copy the implementations (as I did) from here:
https://github.com/BartmanAbyss/gcc/blob/master/libgcc/config/m68k/lb1sf68.S

@tehKaiN
Copy link
Contributor Author

tehKaiN commented Jun 6, 2020

Interestingly, missing symbols are not there, but in libgcc2.c. I've refrained from copying them to my project to prevent it from being "infected" with GPL. I've implemented some by myself, made rest of the code not to use remaining and it works!

I'm not closing this issue since libnix would be a good addition. Perhaps some other ppl could also vote for it by adding thumbs up to 1st post.

@BartmanAbyss
Copy link
Owner

There shouldn't be any license issues: https://www.gnu.org/licenses/gcc-exception-3.1-faq.en.html

@tehKaiN
Copy link
Contributor Author

tehKaiN commented Jun 10, 2020

I've stumbled upon yet another reason for adding libnix - it has a swapstack module which allows for automatically reallocating stack to specified size.

The default for ks1.3 is 4000, which is extremely small for bigger games, especially written in C++, since objects tend to be created in local scope, which consumes stack rapidly.

I'll include the swapstack code in my game library, but probably other toolchain users will have similar problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants