From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 73482 invoked by alias); 29 Apr 2019 14:29:40 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 73450 invoked by uid 89); 29 Apr 2019 14:29:40 -0000 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 Received: from mail-vs1-f45.google.com (HELO mail-vs1-f45.google.com) (209.85.217.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 29 Apr 2019 14:29:38 +0000 Received: by mail-vs1-f45.google.com with SMTP id s11so6025167vsn.0 for ; Mon, 29 Apr 2019 07:29:38 -0700 (PDT) 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: <080b23d2-ddbb-0cd0-97fd-74ba356fff4e@cs.umass.edu> In-Reply-To: <080b23d2-ddbb-0cd0-97fd-74ba356fff4e@cs.umass.edu> From: Sam Habiel Date: Mon, 29 Apr 2019 14:29:00 -0000 Message-ID: Subject: Re: Request for an example x68 assembler portable Hello World script To: cygwin@cygwin.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00217.txt.bz2 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 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