mirror of
https://github.com/torvalds/linux.git
synced 2024-12-10 13:12:04 +00:00
b8c60e8fc6
While uncommon, nolibc executables can be linked together from multiple compilation units. Add some tests to make sure everything works in that case. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/lkml/20231012-nolibc-linkage-test-v1-1-315e682768b4@weissschuh.net/ Acked-by: Willy Tarreau <w@1wt.eu>
27 lines
429 B
C
27 lines
429 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#include "nolibc-test-linkage.h"
|
|
|
|
#ifndef NOLIBC
|
|
#include <errno.h>
|
|
#endif
|
|
|
|
void *linkage_test_errno_addr(void)
|
|
{
|
|
return &errno;
|
|
}
|
|
|
|
int linkage_test_constructor_test_value;
|
|
|
|
__attribute__((constructor))
|
|
static void constructor1(void)
|
|
{
|
|
linkage_test_constructor_test_value = 2;
|
|
}
|
|
|
|
__attribute__((constructor))
|
|
static void constructor2(void)
|
|
{
|
|
linkage_test_constructor_test_value *= 3;
|
|
}
|