public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* AARCH64 : C Model Small Alignment requirements
@ 2017-05-26  8:02 Pankaj Bansal
  2017-05-26  9:06 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Pankaj Bansal @ 2017-05-26  8:02 UTC (permalink / raw)
  To: edk2-devel@lists.01.org, Ard Biesheuvel

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 ?

P.S : This compilation error is not observed with default GCC49/GCC5 options (i.e. C Model tiny and Page Size 0x20)

Thanks & Regards,
Pankaj Bansal



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: AARCH64 : C Model Small Alignment requirements
  2017-05-26  8:02 AARCH64 : C Model Small Alignment requirements Pankaj Bansal
@ 2017-05-26  9:06 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2017-05-26  9:06 UTC (permalink / raw)
  To: Pankaj Bansal; +Cc: edk2-devel@lists.01.org, Varun Sethi

On 26 May 2017 at 01:02, Pankaj Bansal <pankaj.bansal@nxp.com> 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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-26  9:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-26  8:02 AARCH64 : C Model Small Alignment requirements Pankaj Bansal
2017-05-26  9:06 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox