Simon Glass | 70db421 | 2012-02-15 15:51:16 -0800 | [diff] [blame] | 1 | /* |
| 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 Glass | 1865286 | 2013-03-05 14:39:37 +0000 | [diff] [blame] | 12 | #include <asm-generic/sections.h> |
Simon Glass | 99344c8 | 2024-09-20 09:24:25 +0200 | [diff] [blame^] | 13 | #include <linux/compiler_attributes.h> |
Simon Glass | 1865286 | 2013-03-05 14:39:37 +0000 | [diff] [blame] | 14 | |
Simon Glass | 7b3efc6 | 2013-12-03 16:43:23 -0700 | [diff] [blame] | 15 | struct sandbox_cmdline_option; |
Simon Glass | 70db421 | 2012-02-15 15:51:16 -0800 | [diff] [blame] | 16 | |
Marek Behún | d1f81fd | 2021-05-20 13:24:06 +0200 | [diff] [blame] | 17 | static inline struct sandbox_cmdline_option ** |
| 18 | __u_boot_sandbox_option_start(void) |
| 19 | { |
| 20 | static char start[0] __aligned(4) __attribute__((unused)) |
Andrew Scull | 0648b13 | 2022-05-30 10:00:03 +0000 | [diff] [blame] | 21 | __section("_u_boot_sandbox_getopt_start"); |
Marek Behún | d1f81fd | 2021-05-20 13:24:06 +0200 | [diff] [blame] | 22 | |
| 23 | return (struct sandbox_cmdline_option **)&start; |
| 24 | } |
| 25 | |
| 26 | static inline struct sandbox_cmdline_option ** |
| 27 | __u_boot_sandbox_option_end(void) |
| 28 | { |
| 29 | static char end[0] __aligned(4) __attribute__((unused)) |
Andrew Scull | 0648b13 | 2022-05-30 10:00:03 +0000 | [diff] [blame] | 30 | __section("_u_boot_sandbox_getopt_end"); |
Marek Behún | d1f81fd | 2021-05-20 13:24:06 +0200 | [diff] [blame] | 31 | |
| 32 | return (struct sandbox_cmdline_option **)&end; |
| 33 | } |
Simon Glass | 70db421 | 2012-02-15 15:51:16 -0800 | [diff] [blame] | 34 | |
| 35 | static inline size_t __u_boot_sandbox_option_count(void) |
| 36 | { |
Marek Behún | d1f81fd | 2021-05-20 13:24:06 +0200 | [diff] [blame] | 37 | return __u_boot_sandbox_option_end() - __u_boot_sandbox_option_start(); |
Simon Glass | 70db421 | 2012-02-15 15:51:16 -0800 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | #endif |