Re: Avoid stack references in inline assembly

2019-06-22 Thread Vincent Rivière
On 18/06/2019 at 00:05, Jeff Law wrote: If you're going to insist on doing this with an ASM you're likely going to need to only use registers and constants for constraints since otherwise you run the risk of getting a stack address. Thanks for all your clarifications and suggestions. To optim

Re: Avoid stack references in inline assembly

2019-06-19 Thread Segher Boessenkool
On Wed, Jun 19, 2019 at 03:09:08PM +0200, Florian Weimer wrote: > * Segher Boessenkool: > > >> <__GI___getdents64>: > >>0: addis r2,r12,0 > >> 0: R_PPC64_REL16_HA .TOC. > >>4: addir2,r2,0 > >> 4: R_PPC64_REL16_L

Re: Avoid stack references in inline assembly

2019-06-19 Thread Florian Weimer
* Segher Boessenkool: >> <__GI___getdents64>: >>0: addis r2,r12,0 >> 0: R_PPC64_REL16_HA .TOC. >>4: addir2,r2,0 >> 4: R_PPC64_REL16_LO .TOC.+0x4 >>8: li r0,202 >>c: sc >> 10: mfcr

Re: Avoid stack references in inline assembly

2019-06-19 Thread Segher Boessenkool
On Tue, Jun 18, 2019 at 12:19:51PM +0200, Florian Weimer wrote: > For example, on POWER, the condition register is used to indicate > errors. Instead of using that directly, we need to store that in a > register, via mfcr: Hrm, that example shows that my suggestion in https://gcc.gnu.org/ml/gcc/2

Re: Avoid stack references in inline assembly

2019-06-18 Thread Florian Weimer
* Jeff Law: > This is best addressed by changing GCC itself to know about the > different ABIs. Trying to tackle in ASMs is going to be painful, > particularly since your asms change the stack pointer and that's > generally verboten for an ASM. Standard practice is to use generic assembler tramp

Re: Avoid stack references in inline assembly

2019-06-17 Thread Segher Boessenkool
On Mon, Jun 17, 2019 at 04:05:57PM -0600, Jeff Law wrote: > On 6/17/19 2:28 PM, Vincent Rivière wrote: > So what you have here is two different ABIs that have to coexist together? In a way. He want to define something to do syscalls, which you could view as a separate ABI yes. > This is best add

Re: Avoid stack references in inline assembly

2019-06-17 Thread Segher Boessenkool
Hi! On Mon, Jun 17, 2019 at 10:28:37PM +0200, Vincent Rivière wrote: > My goal is to create optimal C bindings for Atari ST system calls, using > m68k-elf-gcc (tested with version 7.1.0). Basically, system calls are > similar to function calls: parameters are stacked in the reverse order, > las

Re: Avoid stack references in inline assembly

2019-06-17 Thread Jeff Law
On 6/17/19 2:28 PM, Vincent Rivière wrote: > Hi, > > My goal is to create optimal C bindings for Atari ST system calls, using > m68k-elf-gcc (tested with version 7.1.0). Basically, system calls are > similar to function calls: parameters are stacked in the reverse order, > last one being a functio