delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/11/29/10:19:17

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:references:in-reply-to:from:date
:message-id:subject:to:content-type; q=dns; s=default; b=IVI8QOo
BjjN74a5k07BfryAgV5xrscxcunvuzAzz9fLDs+Zl7hnk7Cj5RE4M+1t1n2rZEgl
mOa8ZetO0ICrz3xyX87WFn9wJFH5IdXQ8cqyokegOCTr2nmKS1t+MO0dHiOuoKd8
jWttmTrJNTpJ5ZG/SlOSLicrtV1xsaN9fMZs=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:references:in-reply-to:from:date
:message-id:subject:to:content-type; s=default; bh=l3UdLW6koK+z0
9wsrZK8j2mMnWA=; b=SYvkTVipY4ClSx6KTE+KqxvwAkR6i7JsReitsybYRStdU
iuw7EXNDlYSdHS6wSCxSEtGY7W/6bA0zhtDsDgCZo5zM+XixzdJBfHSGdp6qj9N5
86+KTfEycpkz5FBnUEUOA8ZRxnTJ6XNwVTZoHfR6Z3w3qwNVuJYD/ezk0BCrPQ=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=promising, Gmail, Hx-spam-relays-external:209.85.221.68, H*RU:209.85.221.68
X-HELO: mail-wr1-f68.google.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=Gg7JxITETwdewZQLzBqZikhGBoSDXsFK6zPHAdtyTmc=; b=OxqgZnGvlxhH7mDZLWnIBfgDbtzCPnzwozYV6ykSSaRK9b4dNfqnoCe8uEqnpujYzG voheM4HMaDODa2A1K9Tu6VCvqapPwtLtsy8JjURwi8QYph88RVxk84sr6/SsBU0WkwJD CiVJkrlFRFELKoxKk5q642LUNMjjORaGPfF5WM4hlAiLXH6Lucz52LPyfr6dXE2FcuFK bALokKzdMJb6WGaCtnu/suaCwcseiBFMMN4Lqb2C/zcItbhRSgiBgBcDR+28SAkVMcCz UjbUobs5X/vRcnM4Ouuc+Xp9hM28RpmTEFm8+52MU48lQ1VmoxhoOBL3lqnXZKgjBNDW nj0A==
MIME-Version: 1.0
References: <CABHT96207sag6z7LMMDiBQciu-B3o7zFoOkYLw3OOSi_S=Kckg AT mail DOT gmail DOT com> <db507cae25f6f4b20af039bf3931e727d9614f61 DOT camel AT redhat DOT com> <CABHT963855jsHu0r=1f0dHye9k+uGb21EYkSj1SS+06V0bhsjg AT mail DOT gmail DOT com> <20181129085816 DOT GV30649 AT calimero DOT vinschen DOT de>
In-Reply-To: <20181129085816.GV30649@calimero.vinschen.de>
From: Sam Habiel <sam DOT habiel AT gmail DOT com>
Date: Thu, 29 Nov 2018 10:18:37 -0500
Message-ID: <CABHT962ok6x121SezynVto2k1DoQ6T6Wj3J+Nq9O+AQs+uNeRQ@mail.gmail.com>
Subject: Re: 32 bit vs 64 bit Cygwin, followup
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

On Thu, Nov 29, 2018 at 3:58 AM Corinna Vinschen
<corinna-cygwin AT cygwin DOT com> wrote:
>
> Please, no top-posting.
>
> On Nov 28 11:06, Sam Habiel wrote:
> > Yaakov,
> >
> > On Wed, Nov 28, 2018 at 11:01 AM Yaakov Selkowitz <yselkowi AT redhat DOT com> wrote:
> > >
> > > On Mon, 2018-11-26 at 14:07 -0500, Sam Habiel wrote:
> > > > Hello everybody,
> > > >
> > > > In this message
> > > > (https://www.sourceware.org/ml/cygwin/2018-11/msg00190.html), Corinna
> > > > (Hi Corinna!) says:
> > > >
> > > > "Don't do that.  Use 64 bit Cygwin whenever possible.  32 bit is a lost cause."
> > > >
> > > > I would like to mention why I am still using 32 bit Cygwin.
> > > >
> > > > I maintain a port of a database called GT.M
> > > > (https://en.wikipedia.org/wiki/GT.M) on Cygwin. I work with Electronic
> > > > Medical Records that run on this database. GT.M contains a large
> > > > amount of assembly code, written to run on the x32 Linux ABI and the
> > > > AMD x64 ABI. It's was very easy to get the x32 Linux ABI to run on
> > > > Cygwin x32; Cygwin x64 on the other hand uses the Windows x64 ABI,
> > > > which is very different than the AMD ABI (more detail here:
> > > > https://eli.thegreenplace.net/2011/09/06/stack-frame-layout-on-x86-64/).
> > > > I don't have the expertise nor the time to rewrite a lot of assembly
> > > > code to use the Windows x64 ABI. There are about 100 source code files
> > > > that are in assembly.
> > >
> > > -mabi=sysv ?
> > >
> > Are you telling me that gcc has a flag to support AMD ABI on Cygwin
> > x64? The assembly code is not standalone; it gets called from C code
> > and calls C code.
>
> That's what he's telling you.  However, you have to interact with the MS
> ABI(*) as well as soon as you call external library functions so it
> makes sense to keep your C code in MS ABI.  For the assembler functions,
> you can just tell the compiler they are in SYSV ABI by adding a function
> attribute to the declaration:
>
> int asm_func (args) __attribute__ ((sysv_abi))
>
> Good luck,
> Corinna
>
> (*) Just keep in mind that Cygwin is LP64, not LLP64:
>     https://cygwin.com/faq/faq.html#faq.programming.64bitporting
>
> --
> Corinna Vinschen
> Cygwin Maintainer

I use Gmail. Woe is me. And I stick with the defaults. A bit hard to
not top post due to my typical habits. Sorry!

Thank you for your reply Corinna.

This sounds very promising, but I would like a clarification; because
I think you covered 50% of the issue:

1. There are frequent calls from the C code to Assembly.
2. There are also frequent calls from Assembly to C code.

Looks like compiling the .s files with the -mabi=sysv flag and
declaring the function in C with the __attribute__ ((sysv_abi)) will
fix #1.

How about #2? I don't see an easy solution. The assembly code puts
together the parameters in the registers in the sysv way (rdi, rsi,
rdx, rcx, r8, r9), not rcx, rdx, r8, and r9.

Here's an example call:
https://github.com/shabiel/fis-gtm/blob/master/sr_x86_64/opp_tstart.s;
all the other asm code is in the same folder.

--Sam

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019