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 # The -Wn flag passes arguments to PNaCl's native linker (as opposed |
| 2733 # to the bitcode linker, which gets the -Wl arguments) |
| 2734 args = ','.join(['-Wn'] + args) |
| 2735 else: |
| 2736 args = ','.join(['-Wl'] + args) |
2732 else: | 2737 else: |
2733 args = ' '.join(args) | 2738 args = ' '.join(args) |
2734 return args | 2739 return args |
2735 | 2740 |
2736 nacl_env.AddMethod(RodataSwitch) | 2741 nacl_env.AddMethod(RodataSwitch) |
2737 | 2742 |
| 2743 def TextSwitch(env, value): |
| 2744 """ Return a string of arguments to place the text segment at |value|. |
| 2745 Assume the string is going to the compiler driver, rather than directly |
| 2746 to the linker. """ |
| 2747 # The gold linker does not support -Ttext-segment, but -Ttext does the |
| 2748 # same thing that -Ttext-segment does in the bfd linker. However, |
| 2749 # -Ttext seems to be broken in gold currently (see bug |
| 2750 # https://code.google.com/p/nativeclient/issues/detail?id=3573 ) |
| 2751 # Using --section-start .text= as a workaround works because PNaCl only uses |
| 2752 # one text section (no .init etc) |
| 2753 if env.Bit('bitcode'): |
| 2754 return '-Wn,--section-start,.text=' + value |
| 2755 else: |
| 2756 return '-Wl,-Ttext-segment=' + value |
| 2757 |
| 2758 nacl_env.AddMethod(TextSwitch) |
2738 | 2759 |
2739 def AllowNonStableBitcode(env): | 2760 def AllowNonStableBitcode(env): |
2740 """ This modifies the environment to allow features that aren't part | 2761 """ This modifies the environment to allow features that aren't part |
2741 of PNaCl's stable ABI. If tests using these features should be | 2762 of PNaCl's stable ABI. If tests using these features should be |
2742 skipped entirely, this returns False. Otherwise, on success, it | 2763 skipped entirely, this returns False. Otherwise, on success, it |
2743 returns True. | 2764 returns True. |
2744 """ | 2765 """ |
2745 if env.Bit('bitcode'): | 2766 if env.Bit('bitcode'): |
2746 env.SetBits('nonstable_bitcode') | 2767 env.SetBits('nonstable_bitcode') |
2747 return not env.Bit('skip_nonstable_bitcode') | 2768 return not env.Bit('skip_nonstable_bitcode') |
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3653 nacl_env.ValidateSdk() | 3674 nacl_env.ValidateSdk() |
3654 | 3675 |
3655 if BROKEN_TEST_COUNT > 0: | 3676 if BROKEN_TEST_COUNT > 0: |
3656 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 3677 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
3657 if GetOption('brief_comstr'): | 3678 if GetOption('brief_comstr'): |
3658 msg += " Add --verbose to the command line for more information." | 3679 msg += " Add --verbose to the command line for more information." |
3659 print msg | 3680 print msg |
3660 | 3681 |
3661 # separate warnings from actual build output | 3682 # separate warnings from actual build output |
3662 Banner('B U I L D - O U T P U T:') | 3683 Banner('B U I L D - O U T P U T:') |
OLD | NEW |