Brian Silverman | 8649792 | 2018-02-10 19:28:39 -0500 | [diff] [blame^] | 1 | #! /bin/sh |
| 2 | # Copyright (C) 2014 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 | # char c; |
| 21 | # int i; |
| 22 | # long l; |
| 23 | # |
| 24 | # void *v; |
| 25 | # |
| 26 | # struct s |
| 27 | # { |
| 28 | # char *a; |
| 29 | # int i; |
| 30 | # } s; |
| 31 | # |
| 32 | # char ca[16]; |
| 33 | # int ia[32]; |
| 34 | # void *va[64]; |
| 35 | # struct s sa[8]; |
| 36 | |
| 37 | # On x86_64 (LP64): |
| 38 | # gcc -g -c -o testfile-sizes1.o sizes.c |
| 39 | # clang -g -c -o testfile-sizes2.o sizes.c |
| 40 | |
| 41 | # const char c; |
| 42 | # volatile int i; |
| 43 | # const volatile long l; |
| 44 | # |
| 45 | # void * restrict v; |
| 46 | # |
| 47 | # struct s |
| 48 | # { |
| 49 | # const char *a; |
| 50 | # volatile int i; |
| 51 | # } s; |
| 52 | # |
| 53 | # const char ca[16]; |
| 54 | # volatile int ia[32]; |
| 55 | # const volatile void * const volatile restrict va[64]; |
| 56 | # struct s sa[8]; |
| 57 | # double d3d[3][4][5]; |
| 58 | # |
| 59 | # typedef const int foo; |
| 60 | # typedef volatile foo bar; |
| 61 | # foo f; |
| 62 | # bar b; |
| 63 | # |
| 64 | # gcc -std=c99 -g -c -o testfile-sizes3.o sizes.c |
| 65 | |
| 66 | # The file testfile-size4.o is hand-crafted. |
| 67 | |
| 68 | testfiles testfile-sizes1.o testfile-sizes2.o testfile-sizes3.o testfile-sizes4.o |
| 69 | |
| 70 | testrun_compare ${abs_builddir}/aggregate_size -e testfile-sizes1.o <<\EOF |
| 71 | c size 1 |
| 72 | i size 4 |
| 73 | l size 8 |
| 74 | v size 8 |
| 75 | s size 16 |
| 76 | ca size 16 |
| 77 | ia size 128 |
| 78 | va size 512 |
| 79 | sa size 128 |
| 80 | EOF |
| 81 | |
| 82 | testrun_compare ${abs_builddir}/aggregate_size -e testfile-sizes2.o <<\EOF |
| 83 | c size 1 |
| 84 | i size 4 |
| 85 | l size 8 |
| 86 | v size 8 |
| 87 | s size 16 |
| 88 | ca size 16 |
| 89 | ia size 128 |
| 90 | va size 512 |
| 91 | sa size 128 |
| 92 | EOF |
| 93 | |
| 94 | testrun_compare ${abs_builddir}/aggregate_size -e testfile-sizes3.o <<\EOF |
| 95 | c size 1 |
| 96 | i size 4 |
| 97 | l size 8 |
| 98 | v size 8 |
| 99 | s size 16 |
| 100 | ca size 16 |
| 101 | ia size 128 |
| 102 | va size 512 |
| 103 | sa size 128 |
| 104 | d3d size 480 |
| 105 | f size 4 |
| 106 | b size 4 |
| 107 | EOF |
| 108 | |
| 109 | testrun_compare ${abs_builddir}/aggregate_size -e testfile-sizes4.o <<\EOF |
| 110 | v size 257 |
| 111 | EOF |
| 112 | |
| 113 | exit 0 |