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

From: Reinette Chatre
Date: Fri Oct 29 2021 - 13:09:40 EST


Hi Dave,

On 10/28/2021 5:26 PM, 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.


How about a new changelog as below:

The enclave binary (test_encl.elf) is built with only three sections (tcs, text, and data) as controlled by its custom linker script.

If gcc is built with "--enable-linker-build-id" (this appears to be a common configuration even if it is by default off) then gcc will pass "--build-id" to the linker that will prompt it (the linker) to to write unique bits identifying the linked file to a ".note.gnu.build-id" section.

The section ".note.gnu.build-id" does not exist in the test enclave resulting in the following warning emitted by the linker:

/usr/bin/ld: warning: .note.gnu.build-id section discarded, --build-id ignored

The test enclave does not use the build id within the binary so fix the warning by passing a build id of "none" to the linker that will disable the setting from any earlier "--build-id" options and thus disable the attempt to write the build id to a ".note.gnu.build-id" section that does not exist.

Reinette