summaryrefslogtreecommitdiffstats
path: root/tests/run-dwelfgnucompressed.sh
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-11-17 23:52:39 +0100
committerMark Wielaard <mjw@redhat.com>2016-01-06 14:27:10 +0100
commit0c32b6f086b9838fe4b7d93575068554d0c420f7 (patch)
treec0537855b24cbc6f158161bf7a94778bc1ee1487 /tests/run-dwelfgnucompressed.sh
parent0aa60ac643cea053d03a2de2ed7757d907b5e7bb (diff)
downloadandroid_external_elfutils-0c32b6f086b9838fe4b7d93575068554d0c420f7.tar.gz
android_external_elfutils-0c32b6f086b9838fe4b7d93575068554d0c420f7.tar.bz2
android_external_elfutils-0c32b6f086b9838fe4b7d93575068554d0c420f7.zip
libdwelf: Add dwelf_scn_gnu_compressed_size.
Helper function to get the size of a GNU compressed zdebug section. Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'tests/run-dwelfgnucompressed.sh')
-rwxr-xr-xtests/run-dwelfgnucompressed.sh108
1 files changed, 108 insertions, 0 deletions
diff --git a/tests/run-dwelfgnucompressed.sh b/tests/run-dwelfgnucompressed.sh
new file mode 100755
index 00000000..b93a56f2
--- /dev/null
+++ b/tests/run-dwelfgnucompressed.sh
@@ -0,0 +1,108 @@
+#! /bin/sh
+# Copyright (C) 2015 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+# = funcs.s =
+# .globl testfunc
+# testfunc:
+# nop
+# ret
+# .type testfunc, @function
+# .size testfunc, .-testfunc
+#
+# .globl testfunc2
+# testfunc2:
+# call testfunc
+# nop
+# nop
+# ret
+# .type testfunc2, @function
+# .size testfunc2, .-testfunc2
+#
+# .globl functest3
+# functest3:
+# jmp local
+# nop
+# nop
+# local:
+# call testfunc2
+# ret
+# .type functest3, @function
+# .size functest3, .-functest3
+
+# = start.s =
+# .global _start
+# _start:
+# call functest3
+# nop
+# nop
+# nop
+# nop
+# nop
+# nop
+# nop
+# nop
+# nop
+# nop
+# nop
+# nop
+# nop
+# nop
+# nop
+# nop
+# ret
+# .type _start, @function
+# .size _start, .-_start
+
+# gas --compress-debug-sections=zlib-gnu -32 -g -o start.o start.s
+# gas --compress-debug-sections=zlib-gnu -32 -g -o funcs.o funcs.s
+# ld --compress-debug-sections=zlib-gnu -melf_i386 -g -o zgnu32 funcs.o start.o
+
+# gas --compress-debug-sections=zlib-gnu -64 -g -o start.o start.s
+# gas --compress-debug-sections=zlib-gnu -64 -g -o funcs.o funcs.s
+# ld --compress-debug-sections=zlib-gnu -g -o zgnu32 funcs.o start.o
+
+testfiles testfile-zgnu64
+testrun_compare ${abs_top_builddir}/tests/dwelfgnucompressed testfile-zgnu64 <<\EOF
+section 2: GNU Compressed size: 60
+section 3: GNU Compressed size: aa
+section 5: GNU Compressed size: 8d
+EOF
+
+testfiles testfile-zgnu64be
+testrun_compare ${abs_top_builddir}/tests/dwelfgnucompressed testfile-zgnu64be <<\EOF
+section 3: GNU Compressed size: 60
+section 4: GNU Compressed size: 7e
+section 6: GNU Compressed size: 8d
+EOF
+
+testfiles testfile-zgnu32
+testrun_compare ${abs_top_builddir}/tests/dwelfgnucompressed testfile-zgnu32 <<\EOF
+section 2: GNU Compressed size: 40
+section 3: GNU Compressed size: 9a
+section 5: GNU Compressed size: 85
+EOF
+
+testfiles testfile-zgnu32be
+testrun_compare ${abs_top_builddir}/tests/dwelfgnucompressed testfile-zgnu32be <<\EOF
+section 3: GNU Compressed size: 40
+section 4: GNU Compressed size: 6e
+section 6: GNU Compressed size: 85
+EOF
+
+exit 0