public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] install: Delete scripts/output-format.sed and support lld
@ 2020-04-11 23:23 Fangrui Song
  2020-04-30  5:39 ` Fangrui Song
  2020-05-03 20:30 ` Florian Weimer
  0 siblings, 2 replies; 13+ messages in thread
From: Fangrui Song @ 2020-04-11 23:23 UTC (permalink / raw)
  To: libc-alpha; +Cc: Florian Weimer, Adhemerval Zanella, Fangrui Song

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, so we can repurpose the
output-format=unknown branch to make format.lds empty.

GNU ld and gold can skip a script with incompatible OUTPUT_FORMAT and
find the next script in the search path. So libc.so linked with lld
cannot be skipped automatically. However, this is considered a minor
functionality loss by lld maintainers.
---
 Makerules                                     | 12 +++----
 .../strcoll-inputs/filelist#en_US.UTF-8       |  1 -
 scripts/output-format.sed                     | 35 -------------------
 3 files changed, 4 insertions(+), 44 deletions(-)
 delete mode 100644 scripts/output-format.sed

diff --git a/Makerules b/Makerules
index 1e9c18f0d8..6a6e5579ae 100644
--- a/Makerules
+++ b/Makerules
@@ -1067,18 +1067,14 @@ 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>&1 \
-	| sed -n -f $< > $@.new
-	test -s $@.new
-	rm -f $@.so
+# This branch is taken by lld, which auto detects the file format and does not
+# need OUTPUT_FORMAT.
+	echo > $@.new
 endif
 	mv -f $@.new $@
 common-generated += format.lds
diff --git a/benchtests/strcoll-inputs/filelist#en_US.UTF-8 b/benchtests/strcoll-inputs/filelist#en_US.UTF-8
index aa44107ad6..cb981de88c 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
-- 
2.26.0.110.g2183baf09c-goog


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-09-21 11:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-11 23:23 [PATCH] install: Delete scripts/output-format.sed and support lld Fangrui Song
2020-04-30  5:39 ` Fangrui Song
2020-05-03 20:30 ` Florian Weimer
2020-05-03 20:53   ` Fangrui Song
2020-05-03 21:11     ` H.J. Lu
2020-08-31 18:04       ` Fāng-ruì Sòng
2020-08-31 18:07         ` Florian Weimer
2020-08-31 18:52           ` Fāng-ruì Sòng
2020-08-31 23:10             ` H.J. Lu
2020-08-31 23:34               ` Fāng-ruì Sòng
2020-09-01 10:38             ` Florian Weimer
2020-09-01 16:12               ` Fāng-ruì Sòng
2020-09-21 11:31                 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).