OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2011 Google Inc. All rights reserved. | 3 # Copyright (c) 2011 Google Inc. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import os | 7 import os |
8 import tempfile | 8 import tempfile |
9 import shutil | 9 import shutil |
10 import subprocess | 10 import subprocess |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 env={'ar': ar_command, 'cc': cc_command}) | 50 env={'ar': ar_command, 'cc': cc_command}) |
51 | 51 |
52 | 52 |
53 def TestLinkerSupportsThreads(cc_command='cc'): | 53 def TestLinkerSupportsThreads(cc_command='cc'): |
54 """Test whether the linker supports the --threads flag.""" | 54 """Test whether the linker supports the --threads flag.""" |
55 return TestCommands(['%(cc)s -Wl,--threads test.c'], | 55 return TestCommands(['%(cc)s -Wl,--threads test.c'], |
56 files={'test.c': 'int main(){}'}, | 56 files={'test.c': 'int main(){}'}, |
57 env={'cc': cc_command}) | 57 env={'cc': cc_command}) |
58 | 58 |
59 | 59 |
| 60 def TestLinkerSupportsICF(cc_command='cc'): |
| 61 """Test whether the linker supports identical code folding.""" |
| 62 return TestCommands(['%(cc)s -Wl,--icf=safe test.c'], |
| 63 files={'test.c': 'int main(){}'}, |
| 64 env={'cc': cc_command}) |
| 65 |
| 66 |
60 if __name__ == '__main__': | 67 if __name__ == '__main__': |
61 # Run the various test functions and print the results. | 68 # Run the various test functions and print the results. |
62 def RunTest(description, function, **kwargs): | 69 def RunTest(description, function, **kwargs): |
63 print "Testing " + description + ':', | 70 print "Testing " + description + ':', |
64 if function(**kwargs): | 71 if function(**kwargs): |
65 print 'ok' | 72 print 'ok' |
66 else: | 73 else: |
67 print 'fail' | 74 print 'fail' |
68 RunTest("ar 'T' flag", TestArSupportsT) | 75 RunTest("ar 'T' flag", TestArSupportsT) |
69 RunTest("ar 'T' flag with ccache", TestArSupportsT, cc_command='ccache cc') | 76 RunTest("ar 'T' flag with ccache", TestArSupportsT, cc_command='ccache cc') |
70 RunTest("ld --threads", TestLinkerSupportsThreads) | 77 RunTest("ld --threads", TestLinkerSupportsThreads) |
OLD | NEW |