| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 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 | 6 |
| 7 #if !defined(__clang__) |
| 7 /* | 8 /* |
| 8 * The .init section contains one symbol, _init, which is the entry | 9 * The .init section contains one symbol, _init, which is the entry |
| 9 * of a function and hence needs to be aligned in accordance with | 10 * of a function and hence needs to be aligned in accordance with |
| 10 * the NativeClient conventions. | 11 * the NativeClient conventions. |
| 11 */ | 12 */ |
| 12 .section .init | 13 .section .init |
| 13 .p2align NACLENTRYALIGN | 14 .p2align NACLENTRYALIGN |
| 14 .global _init | 15 .global _init |
| 15 _init: | 16 _init: |
| 16 pushq %rbp | 17 pushq %rbp |
| 17 movq %rsp, %rbp | 18 movq %rsp, %rbp |
| 18 /* | 19 /* |
| 19 * The code that follows will be appended by the linker, and will not | 20 * The code that follows will be appended by the linker, and will not |
| 20 * be aligned individually, so we need to align it. | 21 * be aligned individually, so we need to align it. |
| 21 */ | 22 */ |
| 22 .p2align NACLENTRYALIGN | 23 .p2align NACLENTRYALIGN |
| 23 | 24 |
| 24 /* | 25 /* |
| 25 * The .fini section contains one symbol, _fini, which is the entry | 26 * The .fini section contains one symbol, _fini, which is the entry |
| 26 * of a function and hence needs to be aligned in accordance with | 27 * of a function and hence needs to be aligned in accordance with |
| 27 * the NativeClient conventions. | 28 * the NativeClient conventions. |
| 28 */ | 29 */ |
| 29 .section .fini | 30 .section .fini |
| 30 .p2align NACLENTRYALIGN | 31 .p2align NACLENTRYALIGN |
| 31 .global _fini | 32 .global _fini |
| 32 _fini: | 33 _fini: |
| 33 pushq %rbp | 34 pushq %rbp |
| 34 movq %rsp, %rbp | 35 movq %rsp, %rbp |
| 36 #else |
| 37 /* |
| 38 * nacl-clang does not use the .init/.fini mechanism at all, but newlib |
| 39 * still calls _init and _fini, so define them as empty functions in the |
| 40 * text section. |
| 41 */ |
| 42 .section .text |
| 43 .p2align NACLENTRYALIGN |
| 44 .global _init |
| 45 _init: |
| 46 naclret |
| 35 | 47 |
| 48 .p2align NACLENTRYALIGN |
| 49 .global _fini |
| 50 _fini: |
| 51 naclret |
| 52 #endif |
| 36 /* | 53 /* |
| 37 * The code that follows will be appended by the linker, and will not | 54 * The code that follows will be appended by the linker, and will not |
| 38 * be aligned individually, so we need to align it. | 55 * be aligned individually, so we need to align it. |
| 39 */ | 56 */ |
| 40 .p2align NACLENTRYALIGN | 57 .p2align NACLENTRYALIGN |
| OLD | NEW |