[glibc/maskray/lld] install: Replace scripts/output-format.sed with objdump -f
Fangrui Song
maskray@sourceware.org
Mon Dec 28 19:19:32 GMT 2020
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5ed175b2933a8aa955434be7206c42e443577d94
commit 5ed175b2933a8aa955434be7206c42e443577d94
Author: Fangrui Song <maskray@google.com>
Date: Mon Dec 28 11:18:15 2020 -0800
install: Replace scripts/output-format.sed with objdump -f
GNU ld and gold have supported --print-output-format since 2011. glibc
requires binutils>=2.25 (2015), so if LD is GNU ld or gold, we can
assume the option is supported.
lld is by default a cross linker supporting multiple targets. It auto
detects the file format and does not need OUTPUT_FORMAT. It does not
support --print-output-format.
By parsing objdump -f, we can support all the three linkers.
Diff:
---
Makerules | 8 +++---
benchtests/strcoll-inputs/filelist#en_US.UTF-8 | 1 -
scripts/output-format.sed | 35 --------------------------
3 files changed, 3 insertions(+), 41 deletions(-)
diff --git a/Makerules b/Makerules
index ef0fe67d9a..287a58a949 100644
--- a/Makerules
+++ b/Makerules
@@ -1065,17 +1065,15 @@ install: $(inst_slibdir)/libc.so$(libc.so-version)
# for the configuration we are building. We put this statement into
# the linker scripts we install for -lc et al so that they will not be
# used by a link for a different format on a multi-architecture system.
-$(common-objpfx)format.lds: $(..)scripts/output-format.sed \
- $(common-objpfx)config.make \
+$(common-objpfx)format.lds: $(common-objpfx)config.make \
$(common-objpfx)config.h $(..)Makerules
ifneq (unknown,$(output-format))
echo > $@.new 'OUTPUT_FORMAT($(output-format))'
else
$(LINK.o) -shared $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
$(LDFLAGS.so) $(LDFLAGS-lib.so) \
- -x c /dev/null -o $@.so -Wl,--verbose -v 2>/dev/null \
- | sed -n -f $< > $@.new
- test -s $@.new
+ -x c /dev/null -o $@.so 2>/dev/null
+ $(OBJDUMP) -f $@.so | sed -n 's/.*file format \(.*\)/OUTPUT_FORMAT(\1)/;T;p' > $@.new
rm -f $@.so
endif
mv -f $@.new $@
diff --git a/benchtests/strcoll-inputs/filelist#en_US.UTF-8 b/benchtests/strcoll-inputs/filelist#en_US.UTF-8
index 2f4ef195bb..43eb9efb40 100644
--- a/benchtests/strcoll-inputs/filelist#en_US.UTF-8
+++ b/benchtests/strcoll-inputs/filelist#en_US.UTF-8
@@ -9450,7 +9450,6 @@ move-if-change
check-execstack.awk
pylint
pylintrc
-output-format.sed
merge-test-results.sh
update-copyrights
config-uname.sh
diff --git a/scripts/output-format.sed b/scripts/output-format.sed
deleted file mode 100644
index 364f52059f..0000000000
--- a/scripts/output-format.sed
+++ /dev/null
@@ -1,35 +0,0 @@
-/ld.*[ ]-E[BL]/b f
-/collect.*[ ]-E[BL]/b f
-/OUTPUT_FORMAT[^)]*$/{N
-s/\n[ ]*/ /
-}
-t o
-: o
-s/^.*OUTPUT_FORMAT(\([^,]*\), \1, \1).*$/OUTPUT_FORMAT(\1)/
-t q
-s/^.*OUTPUT_FORMAT(\([^,]*\), \([^,]*\), \([^,]*\)).*$/\1,\2,\3/
-t s
-s/^.*OUTPUT_FORMAT(\([^,)]*\).*$)/OUTPUT_FORMAT(\1)/
-t q
-d
-: s
-s/"//g
-G
-s/\n//
-s/^\([^,]*\),\([^,]*\),\([^,]*\),B/OUTPUT_FORMAT(\2)/p
-s/^\([^,]*\),\([^,]*\),\([^,]*\),L/OUTPUT_FORMAT(\3)/p
-s/^\([^,]*\),\([^,]*\),\([^,]*\)/OUTPUT_FORMAT(\1)/p
-/,/s|^|*** BUG in libc/scripts/output-format.sed *** |p
-q
-: q
-s/"//g
-p
-q
-: f
-s/^.*[ ]-E\([BL]\)[ ].*$/,\1/
-t h
-s/^.*[ ]-E\([BL]\)$/,\1/
-t h
-d
-: h
-h
More information about the Glibc-cvs
mailing list