Compiler - overriding ABI

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
JulienDarc
Member
Member
Posts: 97
Joined: Tue Mar 10, 2015 10:08 am

Compiler - overriding ABI

Post by JulienDarc »

My god.. I wished I would never ask such a question. :oops:

Okay, I am creating a compiler. Not the next gcc/clang, as you may have guessed.
But the one that fits my language ("God.. that guy is willing to be burried alive"), without being overly complicated and relying on another language with its runtime libraries (c++).

Only one architecture is needed : x86_64.

I don't want to go multithreading either, and compile there. I coded in C too much and prefer my language (and happen to LOVE machine language.. weird).

Okay. Still there?

Now, for further optimizations in my compiler, I will need to override the x86_64 ABI.
It is just a though right now. But I would like it very much.

After all, an abi is just a rule.. that we may override. =D>

I see no problem in doing this if my compiler is coded to do the hip-hop/funk between function calls and return register.

Do you see a practical problem that I may have overlooked?
Octocontrabass
Member
Member
Posts: 5588
Joined: Mon Mar 25, 2013 7:01 pm

Re: Compiler - overriding ABI

Post by Octocontrabass »

ABIs exist to allow binary blobs to interface with one another, even if they're built with different compilers or written by hand in assembly by different people. You only have to obey the ABI when your code may call (or be called by) a binary blob. GCC and Clang both optimize code by disobeying the ABI when it's safe to do so.

Your ABI doesn't have to be the System V ABI; it just has to be something the caller and callee agree on. You can have more than one ABI.

Some ABI requirements are not safe to disobey. This is mostly an issue on architectures where there isn't very good separation between "user" and "supervisor" mode. I don't think there's anything like that for x86_64, but I'm mentioning it anyway.
JulienDarc
Member
Member
Posts: 97
Joined: Tue Mar 10, 2015 10:08 am

Re: Compiler - overriding ABI

Post by JulienDarc »

Ok, thanks Octocontrabass.

Then, I will happily override it :)
Post Reply