Brian Silverman | 8649792 | 2018-02-10 19:28:39 -0500 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | # Copyright (C) 2015 Red Hat, Inc. |
| 3 | # This file is part of elfutils. |
| 4 | # |
| 5 | # This file is free software; you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # the Free Software Foundation; either version 3 of the License, or |
| 8 | # (at your option) any later version. |
| 9 | # |
| 10 | # elfutils is distributed in the hope that it will be useful, but |
| 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | # |
| 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | . $srcdir/test-subr.sh |
| 19 | |
| 20 | # = funcs.s = |
| 21 | # .globl testfunc |
| 22 | # testfunc: |
| 23 | # nop |
| 24 | # ret |
| 25 | # .type testfunc, @function |
| 26 | # .size testfunc, .-testfunc |
| 27 | # |
| 28 | # .globl testfunc2 |
| 29 | # testfunc2: |
| 30 | # call testfunc |
| 31 | # nop |
| 32 | # nop |
| 33 | # ret |
| 34 | # .type testfunc2, @function |
| 35 | # .size testfunc2, .-testfunc2 |
| 36 | # |
| 37 | # .globl functest3 |
| 38 | # functest3: |
| 39 | # jmp local |
| 40 | # nop |
| 41 | # nop |
| 42 | # local: |
| 43 | # call testfunc2 |
| 44 | # ret |
| 45 | # .type functest3, @function |
| 46 | # .size functest3, .-functest3 |
| 47 | |
| 48 | # = start.s = |
| 49 | # .global _start |
| 50 | # _start: |
| 51 | # call functest3 |
| 52 | # nop |
| 53 | # nop |
| 54 | # nop |
| 55 | # nop |
| 56 | # nop |
| 57 | # nop |
| 58 | # nop |
| 59 | # nop |
| 60 | # nop |
| 61 | # nop |
| 62 | # nop |
| 63 | # nop |
| 64 | # nop |
| 65 | # nop |
| 66 | # nop |
| 67 | # nop |
| 68 | # ret |
| 69 | # .type _start, @function |
| 70 | # .size _start, .-_start |
| 71 | |
| 72 | # gas --compress-debug-sections=zlib-gnu -32 -g -o start.o start.s |
| 73 | # gas --compress-debug-sections=zlib-gnu -32 -g -o funcs.o funcs.s |
| 74 | # ld --compress-debug-sections=zlib-gnu -melf_i386 -g -o zgnu32 funcs.o start.o |
| 75 | |
| 76 | # gas --compress-debug-sections=zlib-gnu -64 -g -o start.o start.s |
| 77 | # gas --compress-debug-sections=zlib-gnu -64 -g -o funcs.o funcs.s |
| 78 | # ld --compress-debug-sections=zlib-gnu -g -o zgnu64 funcs.o start.o |
| 79 | |
| 80 | # gas --compress-debug-sections=zlib-gabi -32 -g -o start.o start.s |
| 81 | # gas --compress-debug-sections=zlib-gabi -32 -g -o funcs.o funcs.s |
| 82 | # ld --compress-debug-sections=zlib-gabi -melf_i386 -g -o zgabi32 funcs.o start.o |
| 83 | |
| 84 | # gas --compress-debug-sections=zlib-gabi -64 -g -o start.o start.s |
| 85 | # gas --compress-debug-sections=zlib-gabi -64 -g -o funcs.o funcs.s |
| 86 | # ld --compress-debug-sections=zlib-gabi -g -o zgabi64 funcs.o start.o |
| 87 | |
| 88 | testfiles testfile-zgnu64 |
| 89 | testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgnu64 <<\EOF |
| 90 | section 1: NOT Compressed |
| 91 | section 2: GNU Compressed size: 60 |
| 92 | section 3: GNU Compressed size: aa |
| 93 | section 4: NOT Compressed |
| 94 | section 5: GNU Compressed size: 8d |
| 95 | section 6: NOT Compressed |
| 96 | section 7: NOT Compressed |
| 97 | section 8: NOT Compressed |
| 98 | EOF |
| 99 | |
| 100 | testfiles testfile-zgabi64 |
| 101 | testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgabi64 <<\EOF |
| 102 | section 1: NOT Compressed |
| 103 | section 2: ELF Compressed ch_type: 1, ch_size: 60, ch_addralign: 10 |
| 104 | section 3: ELF Compressed ch_type: 1, ch_size: aa, ch_addralign: 1 |
| 105 | section 4: NOT Compressed |
| 106 | section 5: ELF Compressed ch_type: 1, ch_size: 8d, ch_addralign: 1 |
| 107 | section 6: NOT Compressed |
| 108 | section 7: NOT Compressed |
| 109 | section 8: NOT Compressed |
| 110 | EOF |
| 111 | |
| 112 | testfiles testfile-zgnu32 |
| 113 | testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgnu32 <<\EOF |
| 114 | section 1: NOT Compressed |
| 115 | section 2: GNU Compressed size: 40 |
| 116 | section 3: GNU Compressed size: 9a |
| 117 | section 4: NOT Compressed |
| 118 | section 5: GNU Compressed size: 85 |
| 119 | section 6: NOT Compressed |
| 120 | section 7: NOT Compressed |
| 121 | section 8: NOT Compressed |
| 122 | EOF |
| 123 | |
| 124 | testfiles testfile-zgabi32 |
| 125 | testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgabi32 <<\EOF |
| 126 | section 1: NOT Compressed |
| 127 | section 2: ELF Compressed ch_type: 1, ch_size: 40, ch_addralign: 8 |
| 128 | section 3: ELF Compressed ch_type: 1, ch_size: 9a, ch_addralign: 1 |
| 129 | section 4: NOT Compressed |
| 130 | section 5: ELF Compressed ch_type: 1, ch_size: 85, ch_addralign: 1 |
| 131 | section 6: NOT Compressed |
| 132 | section 7: NOT Compressed |
| 133 | section 8: NOT Compressed |
| 134 | EOF |
| 135 | |
| 136 | testfiles testfile-zgnu64be |
| 137 | testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgnu64be <<\EOF |
| 138 | section 1: NOT Compressed |
| 139 | section 2: NOT Compressed |
| 140 | section 3: GNU Compressed size: 60 |
| 141 | section 4: GNU Compressed size: 7e |
| 142 | section 5: NOT Compressed |
| 143 | section 6: GNU Compressed size: 8d |
| 144 | section 7: NOT Compressed |
| 145 | section 8: NOT Compressed |
| 146 | section 9: NOT Compressed |
| 147 | EOF |
| 148 | |
| 149 | testfiles testfile-zgabi64be |
| 150 | testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgabi64be <<\EOF |
| 151 | section 1: NOT Compressed |
| 152 | section 2: NOT Compressed |
| 153 | section 3: ELF Compressed ch_type: 1, ch_size: 60, ch_addralign: 10 |
| 154 | section 4: ELF Compressed ch_type: 1, ch_size: 7e, ch_addralign: 1 |
| 155 | section 5: NOT Compressed |
| 156 | section 6: ELF Compressed ch_type: 1, ch_size: 8d, ch_addralign: 1 |
| 157 | section 7: NOT Compressed |
| 158 | section 8: NOT Compressed |
| 159 | section 9: NOT Compressed |
| 160 | EOF |
| 161 | |
| 162 | testfiles testfile-zgnu32be |
| 163 | testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgnu32be <<\EOF |
| 164 | section 1: NOT Compressed |
| 165 | section 2: NOT Compressed |
| 166 | section 3: GNU Compressed size: 40 |
| 167 | section 4: GNU Compressed size: 6e |
| 168 | section 5: NOT Compressed |
| 169 | section 6: GNU Compressed size: 85 |
| 170 | section 7: NOT Compressed |
| 171 | section 8: NOT Compressed |
| 172 | section 9: NOT Compressed |
| 173 | EOF |
| 174 | |
| 175 | testfiles testfile-zgabi32be |
| 176 | testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgabi32be <<\EOF |
| 177 | section 1: NOT Compressed |
| 178 | section 2: NOT Compressed |
| 179 | section 3: ELF Compressed ch_type: 1, ch_size: 40, ch_addralign: 8 |
| 180 | section 4: ELF Compressed ch_type: 1, ch_size: 6e, ch_addralign: 1 |
| 181 | section 5: NOT Compressed |
| 182 | section 6: ELF Compressed ch_type: 1, ch_size: 85, ch_addralign: 1 |
| 183 | section 7: NOT Compressed |
| 184 | section 8: NOT Compressed |
| 185 | section 9: NOT Compressed |
| 186 | EOF |
| 187 | |
| 188 | exit 0 |