mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-08-17 03:50:30 +00:00

Currently exec-target.c is linked statically with libc, which on Fedora at least requires installing an additional package (glibc-static). If that package is not installed the build fails with: CC exec_target /usr/bin/ld: cannot find -lc: No such file or directory collect2: error: ld returned 1 exit status All exec_target.c does is call sys_exit, which can be done easily enough using inline assembly, and removes the requirement for a static libc to be installed. Suggested-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20240812094152.418586-1-maddy@linux.ibm.com
29 lines
572 B
C
29 lines
572 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/*
|
|
* Part of fork context switch microbenchmark.
|
|
*
|
|
* Copyright 2018, Anton Blanchard, IBM Corp.
|
|
*/
|
|
|
|
#define _GNU_SOURCE
|
|
#include <sys/syscall.h>
|
|
|
|
void _start(void)
|
|
{
|
|
asm volatile (
|
|
"li %%r0, %[sys_exit];"
|
|
"li %%r3, 0;"
|
|
"sc;"
|
|
:
|
|
: [sys_exit] "i" (SYS_exit)
|
|
/*
|
|
* "sc" will clobber r0, r3-r13, cr0, ctr, xer and memory.
|
|
* Even though sys_exit never returns, handle clobber
|
|
* registers.
|
|
*/
|
|
: "r0", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
|
|
"r11", "r12", "r13", "cr0", "ctr", "xer", "memory"
|
|
);
|
|
}
|