public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Sam Habiel <sam.habiel@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Request for an example x68 assembler portable Hello World script
Date: Mon, 29 Apr 2019 14:29:00 -0000	[thread overview]
Message-ID: <CABHT9639OXV-8cHGws5f8_GS9gnW9sMaaS47AEkG8hKHfkruvg@mail.gmail.com> (raw)
In-Reply-To: <080b23d2-ddbb-0cd0-97fd-74ba356fff4e@cs.umass.edu>

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@cs.umass.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

      reply	other threads:[~2019-04-29 14:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26  7:25 Jesse Thompson
2019-04-26 11:16 ` Eliot Moss
2019-04-26 21:04 ` Jesse Thompson
2019-04-27  1:56   ` Doug Henderson
2019-04-27 18:35   ` bzs
2019-04-28 20:00   ` Eliot Moss
2019-04-29 14:29     ` Sam Habiel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABHT9639OXV-8cHGws5f8_GS9gnW9sMaaS47AEkG8hKHfkruvg@mail.gmail.com \
    --to=sam.habiel@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).