Bug 1315476

Summary: glibc: save around 600 KiB by making sln and ldconfig the same binary
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: glibcAssignee: Florian Weimer <fweimer>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: arjun.is, codonell, dj, fweimer, jakub, law, mfabian, pfrankli, redhat-bugzilla, siddhesh
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glibc-2.23.90-28.fc25 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-14 07:34:21 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:
Bug Depends On:    
Bug Blocks: 1338879    

Description Florian Weimer 2016-03-07 20:51:58 UTC
Both are statically linked:

$ ls -l /sbin/ldconfig /sbin/sln
-rwxr-xr-x. 1 root root 976264 Feb 19 22:25 /sbin/ldconfig
-rwxr-xr-x. 1 root root 767128 Feb 19 22:25 /sbin/sln

We can use the same binary for both and dispatch on argv[0].  The common core between is around 600 KiB, so that's the saving we can expect.

(Alternatively, we could get rid of sln completely.  Perhaps it is even possible to link ldconfig dynamically.)

Comment 1 Florian Weimer 2016-07-14 07:34:21 UTC
Before:

$ rpmdir /tmp/glibc-2.23.90-27.fc25.x86_64.rpm | grep -E 'ldconfig|sln'
-rwxr-xr-x () 52:1 {(none)} root root 1092656 1468043294 /sbin/ldconfig
-rwxr-xr-x () 53:1 {(none)} root root 895944 1468043295 /sbin/sln

1941 KiB.

After:

-rwxr-xr-x () 52:2 {(none)} root root 1092784 1468434014 /sbin/ldconfig
-rwxr-xr-x () 52:2 {(none)} root root 1092784 1468434014 /sbin/sln

1067 KiB.

Total savings are 874 KiB, slightly larger than predicted.  The minuscule increase in ldconfig size despite the added sln functionality seems to be a result of a alignment constraints, the size tool reports somewhat more realistic numbers:

   text	   data	    bss	    dec	    hex	filename
 982470	   7568	   6760	 996798	  f35be	ldconfig.old
 984310	   7568	   6760	 998638	  f3cee	sln.new