Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2104638

Summary: strip --strip-unneeded doesn't remove the build-id
Product: Red Hat Enterprise Linux 8 Reporter: Paulo Andrade <pandrade>
Component: binutilsAssignee: Nick Clifton <nickc>
binutils sub component: system-version QA Contact: qe-baseos-tools-bugs
Status: CLOSED NOTABUG Docs Contact:
Severity: medium    
Priority: unspecified CC: fweimer, mprchlik, ohudlick, sipoyare
Version: 8.2Flags: pm-rhel: mirror+
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-07-25 08:05:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paulo Andrade 2022-07-06 18:45:17 UTC
From my understanding, this is due to ld merging comment sections,
and workarounds should be either pass --build-id=none to the linker,
or --remove-section=.note.gnu.build-id to strip.

  Can you please clarify if my assumption is incorrect, and the
build-id is expected to not be removed by strip-unneeded.

Comment 1 Nick Clifton 2022-07-07 10:49:52 UTC
(In reply to Paulo Andrade from comment #0)
Hi Paulo,

> From my understanding, this is due to ld merging comment sections,
> and workarounds should be either pass --build-id=none to the linker,
> or --remove-section=.note.gnu.build-id to strip.
> 
>   Can you please clarify if my assumption is incorrect, and the
> build-id is expected to not be removed by strip-unneeded.

It is not expected to be removed by strip-unneeded.  That option is 
intended to remove unneeded *symbols* as well as debug sections.  It
is not intended to remove sections which might be considered to be
of no use, eg because they are not loaded at runtime.  In particular
the option does not remove any ELF format NOTE sections, such as the
.note.gnu.build-id.

(The linker's merging of comment sections is unrelated to this issue).

Also, it is worth mentionining that the .note.gnu.build-id section
*is* needed in an executable binary.  At least in one where the debug
information has been moved into a separate debuginfo file.  In this
sceanario the build-id is also copied to the debuginfo file and it
can be used by tools which consume the debug information, eg gdb, to
verify that the debug info does indeeed apply to the binary to which
it is linked.  (And that the binary has not changed version since
the debug info was created).

The workarounds you mention should be effective, although I do wonder
why you want to use them.  The build-ids are small and do not impeed
the execution of a program, so why remove them ?

Does this explanation help ?

Cheers
  Nick

Comment 2 Nick Clifton 2022-07-25 08:05:10 UTC
I am going to close this BZ as I believe that I have answered the questions raised.  If there are any further points that need to be reviewed or considered, please reopen this BZ.

Comment 3 Paulo Andrade 2022-07-25 12:08:11 UTC
Thanks. The related customer support case had also been closed after your response.