25e1b12ec0
To support arm-ds / armlink it is required that the weak main is located in an object externally to the object using the weak symbol. If the weak symbol is inside the object referring to it, then the weak symbol will be used and this will result in ``` Error: L6200E: Symbol __ARM_use_no_argv multiply defined (by init.o and main.o). ``` as both the weak and strong symbols are used. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
29 lines
940 B
C
29 lines
940 B
C
/*
|
|
* Copyright (c) 2010-2014 Wind River Systems, Inc.
|
|
* Copyright (c) 2021 Nordic Semiconductor ASA
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/* Linkers may treat weak functions differently if they are located within
|
|
* the same object that calls the symbol or not.
|
|
*
|
|
* For example, when using armlink, then if the weak symbol is inside the object
|
|
* referring to it the weak symbol will be used. This will result in the symbol
|
|
* being multiply defined because both the weak and strong symbols are used.
|
|
*
|
|
* To GNU ld, it doesn't matter if the weak symbol is placed in the same object
|
|
* which uses the weak symbol. GNU ld will always link to the strong version.
|
|
*
|
|
* Having the weak main symbol in an independent file ensures that it will be
|
|
* correctly treated by multiple linkers.
|
|
*/
|
|
|
|
#include <kernel_internal.h>
|
|
|
|
void __weak main(void)
|
|
{
|
|
/* NOP default main() if the application does not provide one. */
|
|
arch_nop();
|
|
}
|