blob: 5e1577419b03bd0b38e74d606f225a804e67b7ad [file] [log] [blame]
Simon Glass70db4212012-02-15 15:51:16 -08001/*
2 * decls for symbols defined in the linker script
3 *
4 * Copyright (c) 2012 The Chromium OS Authors.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __SANDBOX_SECTIONS_H
10#define __SANDBOX_SECTIONS_H
11
Simon Glass18652862013-03-05 14:39:37 +000012#include <asm-generic/sections.h>
Simon Glass99344c82024-09-20 09:24:25 +020013#include <linux/compiler_attributes.h>
Simon Glass18652862013-03-05 14:39:37 +000014
Simon Glass7b3efc62013-12-03 16:43:23 -070015struct sandbox_cmdline_option;
Simon Glass70db4212012-02-15 15:51:16 -080016
Marek Behúnd1f81fd2021-05-20 13:24:06 +020017static inline struct sandbox_cmdline_option **
18__u_boot_sandbox_option_start(void)
19{
20 static char start[0] __aligned(4) __attribute__((unused))
Andrew Scull0648b132022-05-30 10:00:03 +000021 __section("_u_boot_sandbox_getopt_start");
Marek Behúnd1f81fd2021-05-20 13:24:06 +020022
23 return (struct sandbox_cmdline_option **)&start;
24}
25
26static inline struct sandbox_cmdline_option **
27__u_boot_sandbox_option_end(void)
28{
29 static char end[0] __aligned(4) __attribute__((unused))
Andrew Scull0648b132022-05-30 10:00:03 +000030 __section("_u_boot_sandbox_getopt_end");
Marek Behúnd1f81fd2021-05-20 13:24:06 +020031
32 return (struct sandbox_cmdline_option **)&end;
33}
Simon Glass70db4212012-02-15 15:51:16 -080034
35static inline size_t __u_boot_sandbox_option_count(void)
36{
Marek Behúnd1f81fd2021-05-20 13:24:06 +020037 return __u_boot_sandbox_option_end() - __u_boot_sandbox_option_start();
Simon Glass70db4212012-02-15 15:51:16 -080038}
39
40#endif