Skip to content

Commit 3d81d23

Browse files
fitzsimgnu-andrew
authored andcommitted
devkit: Remove .comment sections from sysroot objects
Otherwise the comment sections of C runtime objects, including those in static libraries like libc_nonshared.a, contribute RPM package version strings to the .comment section in devkit-produced binaries and libraries. These RPM package strings change frequently, even across minor toolchain updates. Their presence interferes when comparing binaries built with devkits that use different sysroot RPM package sets.
1 parent fbc2718 commit 3d81d23

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

make/devkit/Tools.gmk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ $(foreach p,$(RPM_FILE_LIST),$(eval $(call unrpm,$(p))))
324324
# have it anyway, but just to make sure...
325325
# Patch libc.so and libpthread.so to force linking against libraries in sysroot
326326
# and not the ones installed on the build machine.
327+
# Remove comment sections from static libraries and C runtime objects
328+
# to prevent leaking RHEL-specific package versions into
329+
# devkit-produced binaries.
327330
$(libs) : $(rpms)
328331
@echo Patching libc and pthreads
329332
@(for f in `find $(SYSROOT) -name libc.so -o -name libpthread.so`; do \
@@ -333,6 +336,7 @@ $(libs) : $(rpms)
333336
-e 's|/lib/||g' ) > $$f.tmp ; \
334337
mv $$f.tmp $$f ; \
335338
done)
339+
@find $(SYSROOT) -name '*.[ao]' -exec objcopy --remove-section .comment '{}' ';'
336340
@mkdir -p $(SYSROOT)/usr/lib
337341
@touch $@
338342

0 commit comments

Comments
 (0)