OLD | NEW |
---|---|
1 #! -*- python -*- | 1 #! -*- python -*- |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import atexit | 6 import atexit |
7 import os | 7 import os |
8 import platform | 8 import platform |
9 import re | 9 import re |
10 import subprocess | 10 import subprocess |
(...skipping 2710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2721 # With the --build-id option (which the compiler will pass, but pass it | 2721 # With the --build-id option (which the compiler will pass, but pass it |
2722 # here to be doubly sure), the rodata segment starts with the | 2722 # here to be doubly sure), the rodata segment starts with the |
2723 # .note.gnu.build-id section; without --build-id it starts with .rodata. | 2723 # .note.gnu.build-id section; without --build-id it starts with .rodata. |
2724 if via_compiler: | 2724 if via_compiler: |
2725 args = ['--build-id', '--section-start', '.note.gnu.build-id=' + value] | 2725 args = ['--build-id', '--section-start', '.note.gnu.build-id=' + value] |
2726 else: | 2726 else: |
2727 # If file is linked directly then it's probably some kind of low-level | 2727 # If file is linked directly then it's probably some kind of low-level |
2728 # test so don't use build id and move .rodata to the desired position. | 2728 # test so don't use build id and move .rodata to the desired position. |
2729 args = ['--section-start', '.rodata=' + value] | 2729 args = ['--section-start', '.rodata=' + value] |
2730 if via_compiler: | 2730 if via_compiler: |
2731 args = ','.join(['-Wl'] + args) | 2731 if env.Bit('bitcode'): |
2732 args = ','.join(['-Wn'] + args) | |
Roland McGrath
2013/07/16 18:22:37
Comment about what -Wn means, since it's not a sta
| |
2733 else: | |
2734 args = ','.join(['-Wl'] + args) | |
2732 else: | 2735 else: |
2733 args = ' '.join(args) | 2736 args = ' '.join(args) |
2734 return args | 2737 return args |
2735 | 2738 |
2736 nacl_env.AddMethod(RodataSwitch) | 2739 nacl_env.AddMethod(RodataSwitch) |
2737 | 2740 |
2741 def TextSwitch(env, value): | |
2742 """ Return a string of arguments to place the text segment at |value|. | |
2743 Assume the string is going to the compiler driver, rather than directly | |
2744 to the linker. """ | |
2745 # The gold linker does not support -Ttext-segment, but -Ttext does the | |
2746 # same thing that -Ttext-segment does in the bfd linker. However, | |
2747 # -Ttext seems to be broken in gold currently (see bug | |
2748 # https://code.google.com/p/nativeclient/issues/detail?id=3573 ) | |
2749 # Using --section-start .text= as a workaround works because PNaCl only uses | |
2750 # one text section (no .init etc) | |
2751 if env.Bit('bitcode'): | |
2752 return '-Wn,--section-start,.text=' + value | |
2753 else: | |
2754 return '-Wl,-Ttext-segment=' + value | |
2755 | |
2756 nacl_env.AddMethod(TextSwitch) | |
2738 | 2757 |
2739 def AllowNonStableBitcode(env): | 2758 def AllowNonStableBitcode(env): |
2740 """ This modifies the environment to allow features that aren't part | 2759 """ This modifies the environment to allow features that aren't part |
2741 of PNaCl's stable ABI. If tests using these features should be | 2760 of PNaCl's stable ABI. If tests using these features should be |
2742 skipped entirely, this returns False. Otherwise, on success, it | 2761 skipped entirely, this returns False. Otherwise, on success, it |
2743 returns True. | 2762 returns True. |
2744 """ | 2763 """ |
2745 if env.Bit('bitcode'): | 2764 if env.Bit('bitcode'): |
2746 env.SetBits('nonstable_bitcode') | 2765 env.SetBits('nonstable_bitcode') |
2747 return not env.Bit('skip_nonstable_bitcode') | 2766 return not env.Bit('skip_nonstable_bitcode') |
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3653 nacl_env.ValidateSdk() | 3672 nacl_env.ValidateSdk() |
3654 | 3673 |
3655 if BROKEN_TEST_COUNT > 0: | 3674 if BROKEN_TEST_COUNT > 0: |
3656 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 3675 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
3657 if GetOption('brief_comstr'): | 3676 if GetOption('brief_comstr'): |
3658 msg += " Add --verbose to the command line for more information." | 3677 msg += " Add --verbose to the command line for more information." |
3659 print msg | 3678 print msg |
3660 | 3679 |
3661 # separate warnings from actual build output | 3680 # separate warnings from actual build output |
3662 Banner('B U I L D - O U T P U T:') | 3681 Banner('B U I L D - O U T P U T:') |
OLD | NEW |