From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x22e.google.com (mail-it0-x22e.google.com [IPv6:2607:f8b0:4001:c0b::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2E02A2095A364 for ; Fri, 26 May 2017 02:06:19 -0700 (PDT) Received: by mail-it0-x22e.google.com with SMTP id o5so70386965ith.1 for ; Fri, 26 May 2017 02:06:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xDuvsXdTRxcZZPyzFqqm52OwMouV/bBT/F1xlDkcqNQ=; b=Z+J4G6ATCvFz++umQ9XbBdlwxLQXad6r8oDQj0cy5pnQLstDUiojbjfZeUqq9+v8VX nqV2rVwc/nmoGfA8ov056WjskABaEySTwBRl1f8yi5wD4ntRzFOVFZPts7G0cdzRZd4S p1BgFndHIcRYxdCX0nRYJeJF2lgQIv1pRppTk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xDuvsXdTRxcZZPyzFqqm52OwMouV/bBT/F1xlDkcqNQ=; b=BJyPWm/kX+KUcSHRGjpPPdsDf1qiSvI1U1hxiKwLXSruxOY/VcYYieEyxfdGJSkgCG 5oHOXBdETAHtpfJS4QGJKSH7QzJBAAUU3tIT3QGyHF3S03IMY8DWj0xsS7ADF3j5Wf0O Vf6FvBbPkUFvpbMxL6kuDq3EoLNfyqPVlD54qX//9nXPITrUATWZ8zJXyLkODKvnV/UX qHN/OWn1W+xlsmlanuNLaKhZkHtGyIuTEz70HA4O6MxB+WXvNW7DqkMTPktN14eTRbdl W7RXlYxTTG3AVCqeUMccRkolhUeJjTNmnm49ooutAZajTdcvWGkYDIdRLZdODxv4GplP CIQw== X-Gm-Message-State: AODbwcA1Ei9fl5zhBMlQDx/19A6FFa7+dDbOD1RpB2UFQNIx2m5Cy9pJ h9uA8Dau6aD2F9XlyJMsSN0TRKOf3aWc X-Received: by 10.36.24.4 with SMTP id 4mr3570852itr.6.1495789578478; Fri, 26 May 2017 02:06:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.164.24 with HTTP; Fri, 26 May 2017 02:06:18 -0700 (PDT) In-Reply-To: References: From: Ard Biesheuvel Date: Fri, 26 May 2017 11:06:18 +0200 Message-ID: To: Pankaj Bansal Cc: "edk2-devel@lists.01.org" , Varun Sethi Subject: Re: AARCH64 : C Model Small Alignment requirements X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 May 2017 09:06:19 -0000 Content-Type: text/plain; charset="UTF-8" On 26 May 2017 at 01:02, Pankaj Bansal wrote: > Hello Edk2 team, > > We are facing a compilation error in our ARMV8 based NXP board. > We are using c model small with GCC49 and GCC5. > > "WriteSections64(): %s due to its size (> 1 MB), this module requires 4 KB > section alignment." > > With below GCC options, this error is not observed > > [BuildOptions] > GCC:*_*_AARCH64_CC_FLAGS = -mcmodel=small > + GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x1000 > > My question is, is this necessary to use page size 4K with c model small ? > Yes. The small C model relies on ADRP instructions, which require the link time and load time offsets of the executable to be equal modulo 4096. > P.S : This compilation error is not observed with default GCC49/GCC5 options > (i.e. C Model tiny and Page Size 0x20) > The tiny C model does not have this limitation because it uses ADR instructions instead, whose range is limited to 1 MB. The PE/COFF conversion tool will convert small C model code to tiny C model code if it can, i.e., if the module size < 1 MB. For bigger modules, this is not possible, which is when you get the error above.