Re: [PATCH V2 01/15] selftests/x86/sgx: Fix a benign linker warning

From: Sean Christopherson
Date: Fri Oct 29 2021 - 10:56:08 EST


On Thu, Oct 28, 2021, Dave Hansen wrote:
> On 10/28/21 1:37 PM, Reinette Chatre wrote:
> > From: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
> >
> > Pass a build id of "none" to the linker to suppress a warning about the
> > build id being ignored:
> >
> > /usr/bin/ld: warning: .note.gnu.build-id section discarded, --build-id
> > ignored.
>
> Do we have a good grasp on why this is producing a warning in the first
> place? This seems like something that could get merged quickly with one
> more sentence in the changelog.

The SGX selftests use a custom linker script, tools/testing/selftests/sgx/test_encl.lds,
to configure the resulting enclave binary so that it's loadable as an enclave
more or less as-is. One of the things the script does is drop sections the
selftests doesn't want, .note* sections being in that category. I don't recall
exactly why the script drops sections; I assume it's to simply the loading process.
Anyways, .note.gnu.build-id is collateral damage and the linker complains.