diff options
author | Richard Lowe <richlowe@richlowe.net> | 2021-10-03 18:50:39 -0500 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2021-11-06 14:54:00 -0500 |
commit | 252adeb303174e992b64771bf9639e63a4d55418 (patch) | |
tree | 0faba8d6b598747a2dac61ce2cd458fd43bf3928 /usr/src/test | |
parent | c53c97f77356a767b8a3cec554ede591cf4074d9 (diff) | |
download | illumos-gate-252adeb303174e992b64771bf9639e63a4d55418.tar.gz |
14155 ld(1) string table merging could be much faster
14157 ld(1) string table merging should follow gABI more closely
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/test')
-rw-r--r-- | usr/src/test/elf-tests/runfiles/default.run | 5 | ||||
-rw-r--r-- | usr/src/test/elf-tests/tests/Makefile | 1 | ||||
-rw-r--r-- | usr/src/test/elf-tests/tests/string-merge/Makefile | 47 | ||||
-rw-r--r-- | usr/src/test/elf-tests/tests/string-merge/simple.sh | 56 | ||||
-rw-r--r-- | usr/src/test/elf-tests/tests/string-merge/str1.s | 6 | ||||
-rw-r--r-- | usr/src/test/elf-tests/tests/string-merge/str2.s | 4 |
6 files changed, 118 insertions, 1 deletions
diff --git a/usr/src/test/elf-tests/runfiles/default.run b/usr/src/test/elf-tests/runfiles/default.run index 87b7cd352e..d5010ef2bc 100644 --- a/usr/src/test/elf-tests/runfiles/default.run +++ b/usr/src/test/elf-tests/runfiles/default.run @@ -10,7 +10,7 @@ # http://www.illumos.org/license/CDDL. # -# Copyright 2018, Richard Lowe. +# Copyright 2021, Richard Lowe. [DEFAULT] pre = @@ -32,6 +32,9 @@ tests = ['test-parser'] [/opt/elf-tests/tests/mapfiles/assert] tests = ['test-assert'] +[/opt/elf-tests/tests/string-merge/] +tests = ['simple'] + [/opt/elf-tests/tests/tls/amd64/ie] arch = i86pc tests = ['amd64-ie-test'] diff --git a/usr/src/test/elf-tests/tests/Makefile b/usr/src/test/elf-tests/tests/Makefile index 060d1c2e3e..47f18e8093 100644 --- a/usr/src/test/elf-tests/tests/Makefile +++ b/usr/src/test/elf-tests/tests/Makefile @@ -18,6 +18,7 @@ SUBDIRS = \ assert-deflib \ linker-sets \ mapfiles \ + string-merge \ tls include $(SRC)/test/Makefile.com diff --git a/usr/src/test/elf-tests/tests/string-merge/Makefile b/usr/src/test/elf-tests/tests/string-merge/Makefile new file mode 100644 index 0000000000..809eac39bf --- /dev/null +++ b/usr/src/test/elf-tests/tests/string-merge/Makefile @@ -0,0 +1,47 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# Copyright 2021, Richard Lowe. + +include $(SRC)/cmd/Makefile.cmd +include $(SRC)/test/Makefile.com + +PROG = simple + +DATAFILES = str1.s str2.s + +ROOTOPTPKG = $(ROOT)/opt/elf-tests +TESTDIR = $(ROOTOPTPKG)/tests/string-merge + +CMDS = $(PROG:%=$(TESTDIR)/%) +$(CMDS) := FILEMODE = 0555 + + +DATA = $(DATAFILES:%=$(TESTDIR)/%) +$(DATA) := FILEMODE = 0444 + +all: $(PROG) + +install: all $(CMDS) $(DATA) + +clobber: clean + -$(RM) $(PROG) + +clean: + -$(RM) $(CLEANFILES) + +$(CMDS): $(TESTDIR) $(PROG) + +$(TESTDIR): + $(INS.dir) + +$(TESTDIR)/%: % + $(INS.file) diff --git a/usr/src/test/elf-tests/tests/string-merge/simple.sh b/usr/src/test/elf-tests/tests/string-merge/simple.sh new file mode 100644 index 0000000000..5715fa5a97 --- /dev/null +++ b/usr/src/test/elf-tests/tests/string-merge/simple.sh @@ -0,0 +1,56 @@ +#!/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# Copyright 2021, Richard Lowe. + +TESTDIR=$(dirname $0) + +tmpdir=/tmp/test.$$ +mkdir $tmpdir +cd $tmpdir + +cleanup() { + cd / + rm -fr $tmpdir +} + +trap 'cleanup' EXIT + +if [[ $PWD != $tmpdir ]]; then + print -u2 "Failed to create temporary directory: $tmpdir" + exit 1; +fi + +assemble() { + gcc -c -o $2 $1 + if (( $? != 0 )); then + print -u2 "assembly of ${1} failed"; + exit 1; + fi +} + +# We expect any alternate linker to be in LD_ALTEXEC for us already +assemble ${TESTDIR}/str1.s str1.o +assemble ${TESTDIR}/str2.s str2.o + +gcc -shared -o strmerge.so str1.o str2.o +if (( $? != 0 )); then + print -u2 "link of ${TESTDIR}/str[12].o failed"; + exit 1; +fi + +elfdump -N.test -w /dev/stdout strmerge.so | tr '\0' ' ' | grep -q '^ buffalo bills $' +if (( $? != 0 )); then + print -u2 "Merged section contains unexpected data"; + elfdump -N.test -w /dev/stdout strmerge.so | tr '\0' ' ' >&2 + exit 1; +fi diff --git a/usr/src/test/elf-tests/tests/string-merge/str1.s b/usr/src/test/elf-tests/tests/string-merge/str1.s new file mode 100644 index 0000000000..69c5e462e5 --- /dev/null +++ b/usr/src/test/elf-tests/tests/string-merge/str1.s @@ -0,0 +1,6 @@ + .section .test,"aSM",@progbits,1 + .asciz "buffalo" + .asciz "buffalo" + .asciz "buffalo" + .asciz "buffalo" + .asciz "buffalo" diff --git a/usr/src/test/elf-tests/tests/string-merge/str2.s b/usr/src/test/elf-tests/tests/string-merge/str2.s new file mode 100644 index 0000000000..d143d1c10a --- /dev/null +++ b/usr/src/test/elf-tests/tests/string-merge/str2.s @@ -0,0 +1,4 @@ + .section .test,"aSM",@progbits,1 + .asciz "bills" + .asciz "uffalo" + .asciz "ills" |