Commit | Line | Data |
---|---|---|
032ce4e9 ST |
1 | # icf_safe_test.sh -- test --icf=safe |
2 | ||
3 | # Copyright 2009 Free Software Foundation, Inc. | |
4 | # Written by Sriraman Tallam <tmsriram@google.com>. | |
5 | ||
6 | # This file is part of gold. | |
7 | ||
8 | # This program is free software; you can redistribute it and/or modify | |
9 | # it under the terms of the GNU General Public License as published by | |
10 | # the Free Software Foundation; either version 3 of the License, or | |
11 | # (at your option) any later version. | |
12 | ||
13 | # This program is distributed in the hope that it will be useful, | |
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | # GNU General Public License for more details. | |
17 | ||
18 | # You should have received a copy of the GNU General Public License | |
19 | # along with this program; if not, write to the Free Software | |
20 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
21 | # MA 02110-1301, USA. | |
22 | ||
23 | # The goal of this program is to verify if --icf=safe works as expected. | |
24 | # File icf_safe_test.cc is in this test. This program checks if only | |
25 | # ctors and dtors are folded. | |
26 | ||
27 | check_nofold() | |
28 | { | |
29 | func_addr_1=`grep $2 $1 | awk '{print $1}'` | |
30 | func_addr_2=`grep $3 $1 | awk '{print $1}'` | |
31 | if [ $func_addr_1 = $func_addr_2 ] | |
32 | then | |
33 | echo "Safe Identical Code Folding folded" $2 "and" $3 | |
34 | exit 1 | |
35 | fi | |
36 | } | |
37 | ||
38 | check_fold() | |
39 | { | |
40 | func_addr_1=`grep $2 $1 | awk '{print $1}'` | |
41 | func_addr_2=`grep $3 $1 | awk '{print $1}'` | |
42 | if [ $func_addr_1 != $func_addr_2 ] | |
43 | then | |
44 | echo "Safe Identical Code Folding did not fold " $2 "and" $3 | |
45 | exit 1 | |
46 | fi | |
47 | } | |
48 | ||
49 | check_nofold icf_safe_test.stdout "kept_func_1" "kept_func_2" | |
50 | check_fold icf_safe_test.stdout "_ZN1AD1Ev" "_ZN1AC1Ev" |