Bug 2126477

Summary: glibc: Strip annobin related symbols from ld.so
Product: [Fedora] Fedora Reporter: Arjun Shankar <ashankar>
Component: glibcAssignee: Carlos O'Donell <codonell>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 35CC: aoliva, arjun.is, codonell, dj, fweimer, law, mcermak, mcoufal, mfabian, nickc, pfrankli, rth, sipoyare, skolosov
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glibc-2.36.9000-7.fc38 glibc-2.36-7.fc37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-10-19 07:23:30 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 Arjun Shankar 2022-09-13 14:06:04 UTC
Florian noticed that ld.so is shipped with several annobin symbols:

$ rpm -q glibc
glibc-2.34-42.fc35.x86_64
glibc-2.34-42.fc35.i686
$ eu-readelf -s /lib64/ld-linux-x86-64.so.2 | grep annobin | wc -l
1400
$ eu-readelf -s /lib64/ld-linux-x86-64.so.2  | wc -l
2104
$ 

Making sure that they are unnecessary, then stripping these should lead to some significant savings.

Comment 1 Arjun Shankar 2022-09-13 14:07:22 UTC
Nick, can we safely strip these?

Comment 2 Nick Clifton 2022-09-14 08:58:49 UTC
(In reply to Arjun Shankar from comment #1)
> Nick, can we safely strip these?

Yes.

(That was easy!)

The symbols are used by the linker to compute regions of code covered by particular gcc command line options.  This information is then stored in the annobin notes.  Once the link has completed, the note information is fully resolved and the symbols are no longer needed.

Comment 3 Florian Weimer 2022-09-14 09:12:44 UTC
(In reply to Nick Clifton from comment #2)
> (In reply to Arjun Shankar from comment #1)
> > Nick, can we safely strip these?
> 
> Yes.
> 
> (That was easy!)
> 
> The symbols are used by the linker to compute regions of code covered by
> particular gcc command line options.  This information is then stored in the
> annobin notes.  Once the link has completed, the note information is fully
> resolved and the symbols are no longer needed.

Thanks, Nick. Could you recommend a strip command to achieve this? We want to preserve all other symbol and debugging information if possible.

Comment 4 Nick Clifton 2022-09-14 09:24:45 UTC
(In reply to Florian Weimer from comment #3)
 
> Thanks, Nick. Could you recommend a strip command to achieve this? We want
> to preserve all other symbol and debugging information if possible.

I can - although it takes two commands as strip does not have a regexp symbol name matcher:

  nm --format=just-symbols ld.so | grep annobin > remove-these-symbols
  objcopy --strip-symbols=remove-these-symbols ld.so ld.so.stripped

Comment 5 Florian Weimer 2022-09-14 10:58:50 UTC
Thanks, Nick. Working on incorporating this into the package.

Comment 6 Florian Weimer 2022-09-23 10:17:03 UTC
This needs a follow-up fix because there are no .annobin symbols on 32-bit Arm (because we disabled annobin there).

Comment 7 Fedora Update System 2022-10-17 21:47:06 UTC
FEDORA-2022-12af0b08c8 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-12af0b08c8

Comment 8 Fedora Update System 2022-10-18 12:40:39 UTC
FEDORA-2022-12af0b08c8 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-12af0b08c8`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-12af0b08c8

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2022-10-19 07:23:30 UTC
FEDORA-2022-12af0b08c8 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.