Message ID | 545aac243037bf5c2640929c4d8ff5c1edfe3ef8.1635447301.git.reinette.chatre@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | selftests/sgx: Oversubscription, page permission, thread entry | expand |
On 10/28/21 1:37 PM, Reinette Chatre wrote: > From: Sean Christopherson <sean.j.christopherson@intel.com> > > 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.
On Thu, Oct 28, 2021, Dave Hansen wrote: > On 10/28/21 1:37 PM, Reinette Chatre wrote: > > From: Sean Christopherson <sean.j.christopherson@intel.com> > > > > 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.
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@intel.com> >> >> 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
On 10/29/21 10:09 AM, Reinette Chatre wrote: > 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@intel.com> >>> >>> 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. Looks great, thanks for putting that together!
diff --git a/tools/testing/selftests/sgx/Makefile b/tools/testing/selftests/sgx/Makefile index 7f12d55b97f8..2956584e1e37 100644 --- a/tools/testing/selftests/sgx/Makefile +++ b/tools/testing/selftests/sgx/Makefile @@ -45,7 +45,7 @@ $(OUTPUT)/sign_key.o: sign_key.S $(CC) $(HOST_CFLAGS) -c $< -o $@ $(OUTPUT)/test_encl.elf: test_encl.lds test_encl.c test_encl_bootstrap.S - $(CC) $(ENCL_CFLAGS) -T $^ -o $@ + $(CC) $(ENCL_CFLAGS) -T $^ -o $@ -Wl,--build-id=none EXTRA_CLEAN := \ $(OUTPUT)/test_encl.elf \