From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <44492CEA.7050103@asgaard.homelinux.org> Date: Fri, 21 Apr 2006 21:05:14 +0200 From: =?ISO-8859-1?Q?=22Nils_O=2E_Sel=E5sdal=22?= User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] OS X threads + dynamic linking References: <3e1162e60604210924h2a12fd99n171afc7893b5e646@mail.gmail.com> In-Reply-To: <3e1162e60604210924h2a12fd99n171afc7893b5e646@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 4411d03c-ead1-11e9-9d60-3106f5b1d025 David Leimbach wrote: > Actually, this code violates the ABI. The stack needs to be aligned > on a 16byte address. > > http://developer.apple.com/documentation/DeveloperTools/Conceptual/LowLevelABI/index.html > > So the assembly block should be: > > asm( > "pushal\n" > "movl 8(%ebp), %ebx\n" > "movl 12(%ebp), %eax\n" > "xchgl %esp, %eax\n" > "subl $0xc, %esp\n" //need to align the stack... can't just pushl > "pushl %eax\n" > "call *%ebx\n" > "popl %esp\n" > "popal\n" > ); > > Just don't compile with -Os because gcc freaking inlines runonstack. *shrug* > Whom to throttle for that one? I guess you could tack on a __attribute__ ((noinline)) to the prototype. (as always, gcc is beeing "nice" enough to provide hacks that gets you out of the trouble it created for you in the first place)