delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/04/29/10:29:29

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=Nm/2v6Q
/6afqiTw/VQbjEC1c3o4tILIc3Svd1hckbsjUNQUbY+XTw+su06U5yhEHxjxUpp4
babxIT32xBymxjP/YpBJeVdLUIgD82vt2dLQcpxpLCQqJkkeSNNZJnrTN8eXXUXR
zESyXgIjKWNVKI72zFpCiO5u7e0arQleHGlA=
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=27iiUY/ZE76Rz
txheOWKU49nDe4=; b=U2Xlw5BNjdiVFuzC/akW/qj0YpOIbrPTT9y7wGuv49Z8b
FiowEChLKTGw7l0c+gWCY5w+7KxGrvte+Ss1XaaycLS2Ai1CxzKXwiLynHfPz6sh
BGZc6d9EwC5TNA6Lpb6sWIx5VmKALWqQt2WDX3cKb1P4oRxyKQoD/QYLgPGdNo=
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,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=ray, AMD64, UD:cygwin.com, cygwincom
X-HELO: mail-vs1-f45.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=aqlacZPD5f/HTJ4FJ0Vzw4bgE1IG9T4SXNmy+GyC5Bw=; b=U5VuDv915gSHdm0LS4MOC+vB/lTj/hSP8WeHqF6YXJP0ZaOCtwj4TEBnPz/d7LnhQ+ VLqIgcBSNvnYRPeoVadkwJFOuzOvY15xfAsi6cO0nq4zqQbkcIxOhBEw3P7p0RkOH8em dvtNLtfH0RttbAau/DRt+GrBdSGK0exhmC/FIfgMyWYMrHRojVrcUfc6bmIrutSqbvXE tvM43HRL4b1ocLqGe/AfZwmnqrM/LcWMwQOw7rG//LMmNaizdpBdaBRQCdgAxB2lspNL 3U/QBClIzlqz0C3HIbGspawLZHeP9OOC8cC5ide3o405LBsQ/W5FL5aWkwMZ3KRToTzm 0FHg==
MIME-Version: 1.0
References: <CA+wh7Kg4UAO+_ZBONXbJ=3Hf9Tz6LSX2DX+LQNPLYqty4wkTag AT mail DOT gmail DOT com> <CA+wh7Kg+KDGN0b=-UFZ7UnX_fgHw69p_PXmdaqSrncHZsVGCbA AT mail DOT gmail DOT com> <080b23d2-ddbb-0cd0-97fd-74ba356fff4e AT cs DOT umass DOT edu>
In-Reply-To: <080b23d2-ddbb-0cd0-97fd-74ba356fff4e@cs.umass.edu>
From: Sam Habiel <sam DOT habiel AT gmail DOT com>
Date: Mon, 29 Apr 2019 10:29:23 -0400
Message-ID: <CABHT9639OXV-8cHGws5f8_GS9gnW9sMaaS47AEkG8hKHfkruvg@mail.gmail.com>
Subject: Re: Request for an example x68 assembler portable Hello World script
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

I frequently cannot contribute discussion to Cygwin topics, but due to
my work porting a database (fis-gtm) to Cygwin, I can chime in here.

This is a good article to give you an overview of the different
calling conventions out there:
https://eli.thegreenplace.net/2011/09/06/stack-frame-layout-on-x86-64.

Here's a summary of what I learned:
1. Cygwin x32 and Linux x32 use the same assembly layout--application
binary interface (ABI).
2. Cygwin x64 uses the Windows 64 ABI. Linux x64 uses the AMD64 ABI.

This tutorial article is a good place to learn about x64 ABI for
Linux: https://cs.lmu.edu/~ray/notes/gasexamples/.

--Sam

On Sun, Apr 28, 2019 at 4:00 PM Eliot Moss <moss AT cs DOT umass DOT edu> wrote:
>
> On 4/26/2019 5:04 PM, Jesse Thompson wrote:
>
> > Ultimately what I am trying to research is how to begin building a simple
> > compilation system of my own, so how do the *makers* of compilers deal with
> > these differences in calling convention?
>
> They make parts of the compilers conditional on the overall platform.
> For example, if a compiler is written in C / C++, they use #define
> and #if tests, and may include different modules in a build, etc.
>
> They also try to code various algorithms, such a register allocation,
> to be parameterized by a description of how things work on a given
> platform.
>
> There are whole swaths that are essentially target independent,
> especially those having to do with higher level optimizations.
> However, even there, platform differences may lead to different
> parameter settings (e.g., default number of times to unroll a
> loop) or strategies (presence / absence of vector units and
> of predicated instructions (as on the ARM) affect how you want
> to generate even the high-level target-independent code).
>
> In the case that you are talking about, most of the code generation
> and optimization strategies are the same -- there are just some
> fine points different about calling sequences, register usage
> conventions, etc.  I think those are mostly addressed by the kind
> of parameterization-by-descriptions (or by #defines) that I have
> described.
>
> You may still see somewhat different code from different compilers,
> even for the same platform, simply because the different designers
> chose different base code sequences - which may be equivalent. For
> example, to move a constant into a register, add-immediate (adding
> to zero) and or-immediate (again, ORing with zero) give the same
> result for many arguments, to the choice is arbitrary.  One can
> come up with many such examples.
>
> Supporting multiple target instruction sets, or even the range of
> models of the x86 line, requires some amount of platform-specific
> work, of course, and lot of attention to how to build components
> that are either independent of the ISA or retargetable in some way.
>
> Regards - Eliot Moss
>
> --
> 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
>

--
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