Torsten Rasmussen | 25e1b12 | 2021-05-31 14:59:23 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2010-2014 Wind River Systems, Inc. |
| 3 | * Copyright (c) 2021 Nordic Semiconductor ASA |
| 4 | * |
| 5 | * SPDX-License-Identifier: Apache-2.0 |
| 6 | */ |
| 7 | |
| 8 | /* Linkers may treat weak functions differently if they are located within |
| 9 | * the same object that calls the symbol or not. |
| 10 | * |
| 11 | * For example, when using armlink, then if the weak symbol is inside the object |
| 12 | * referring to it the weak symbol will be used. This will result in the symbol |
| 13 | * being multiply defined because both the weak and strong symbols are used. |
| 14 | * |
| 15 | * To GNU ld, it doesn't matter if the weak symbol is placed in the same object |
| 16 | * which uses the weak symbol. GNU ld will always link to the strong version. |
| 17 | * |
| 18 | * Having the weak main symbol in an independent file ensures that it will be |
| 19 | * correctly treated by multiple linkers. |
| 20 | */ |
| 21 | |
| 22 | #include <kernel_internal.h> |
| 23 | |
Stephanos Ioannidis | fa5fd41 | 2022-11-05 00:22:25 +0900 | [diff] [blame] | 24 | int __weak main(void) |
Torsten Rasmussen | 25e1b12 | 2021-05-31 14:59:23 +0200 | [diff] [blame] | 25 | { |
| 26 | /* NOP default main() if the application does not provide one. */ |
| 27 | arch_nop(); |
Stephanos Ioannidis | fa5fd41 | 2022-11-05 00:22:25 +0900 | [diff] [blame] | 28 | |
Stephanos Ioannidis | fa5fd41 | 2022-11-05 00:22:25 +0900 | [diff] [blame] | 29 | return 0; |
Torsten Rasmussen | 25e1b12 | 2021-05-31 14:59:23 +0200 | [diff] [blame] | 30 | } |