[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CV03QFOJR0PY.8QYY51SMOAO2@suppilovahvero>
Date: Wed, 23 Aug 2023 20:31:32 +0300
From: "Jarkko Sakkinen" <jarkko@...nel.org>
To: "Jo Van Bulck" <jo.vanbulck@...kuleuven.be>, <kai.huang@...el.com>,
<linux-sgx@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Cc: <dave.hansen@...ux.intel.com>
Subject: Re: [PATCH v3 9/9] selftests/sgx: Specify freestanding environment
for enclave compilation
On Wed Aug 23, 2023 at 3:57 PM EEST, Jo Van Bulck wrote:
> On 22.08.23 12:14, Jarkko Sakkinen wrote:
> > Do you still need nostdfiles and nostartfiles with freestanding?
>
> Thanks, good question. I tested that compiling with only -ffreestanding
> yields:
>
> /* snipped */
> /usr/local/bin/ld:
> /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/rcrt1.o: in
> function `_start':
> (.text+0x24): undefined reference to `main'
> /* snipped */
>
> So we definitely still need -nostartfiles to prevent the compiler/linker
> from introducing the standard system startup functions. However, in my
> understanding, -nostdlib (which is what I assume you mean with
> nostdfiles) already implies the individual options -nodefaultlibs and
> -nostartfiles.
>
> Thus, we definitely still need -nostartfiles and I'm not 100% sure we
> don't need -nostdlib (though it compiles fine for me with only
> -nostartfiles). Gcc only specifies:
>
> -ffreestanding
> Assert that compilation targets a freestanding environment. This
> implies -fno-builtin. A freestanding environment is one in which the
> standard library may not exist, and program startup may not necessarily
> be at "main".
>
> Bottom line: I suggest to keep -nostdlib to be sure and remove
> -nostartfiles (as it is redundant). I'll include this in the next patch
> iteration.
>
> Best,
> Jo
OK, cool, sounds like plan.
BR, Jarkko
Powered by blists - more mailing lists