sandbox: Rename getopt sections
Rename the sections used for defining sandbox command line options so that they don't start with a '.'. ELF says that sections starting with a '.' are reserved for system use, but the sandbox runs as a normal user process so should be using user sections instead. Clang's ASAN adds redzones to non-user sections and the extra padding meant that the list of options was being corrupted. Naming the sections as user sections avoids this issue as clang handles them as we intended. Signed-off-by: Andrew Scull <ascull@google.com>
This commit is contained in:
parent
aac53d3d96
commit
0648b13269
@ -22,9 +22,9 @@ SECTIONS
|
|||||||
}
|
}
|
||||||
|
|
||||||
_u_boot_sandbox_getopt : {
|
_u_boot_sandbox_getopt : {
|
||||||
*(.u_boot_sandbox_getopt_start)
|
*(_u_boot_sandbox_getopt_start)
|
||||||
KEEP(*(.u_boot_sandbox_getopt))
|
KEEP(*(_u_boot_sandbox_getopt))
|
||||||
*(.u_boot_sandbox_getopt_end)
|
*(_u_boot_sandbox_getopt_end)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ SECTIONS
|
|||||||
}
|
}
|
||||||
|
|
||||||
_u_boot_sandbox_getopt : {
|
_u_boot_sandbox_getopt : {
|
||||||
*(.u_boot_sandbox_getopt_start)
|
*(_u_boot_sandbox_getopt_start)
|
||||||
*(.u_boot_sandbox_getopt)
|
*(_u_boot_sandbox_getopt)
|
||||||
*(.u_boot_sandbox_getopt_end)
|
*(_u_boot_sandbox_getopt_end)
|
||||||
}
|
}
|
||||||
|
|
||||||
efi_runtime_start : {
|
efi_runtime_start : {
|
||||||
|
@ -44,7 +44,7 @@ struct sandbox_cmdline_option {
|
|||||||
.callback = sandbox_cmdline_cb_##f, \
|
.callback = sandbox_cmdline_cb_##f, \
|
||||||
}; \
|
}; \
|
||||||
/* Ppointer to the struct in a special section for the linker script */ \
|
/* Ppointer to the struct in a special section for the linker script */ \
|
||||||
static __used __section(".u_boot_sandbox_getopt") \
|
static __used __section("_u_boot_sandbox_getopt") \
|
||||||
struct sandbox_cmdline_option \
|
struct sandbox_cmdline_option \
|
||||||
*sandbox_cmdline_option_##f##_ptr = \
|
*sandbox_cmdline_option_##f##_ptr = \
|
||||||
&sandbox_cmdline_option_##f
|
&sandbox_cmdline_option_##f
|
||||||
|
@ -17,7 +17,7 @@ static inline struct sandbox_cmdline_option **
|
|||||||
__u_boot_sandbox_option_start(void)
|
__u_boot_sandbox_option_start(void)
|
||||||
{
|
{
|
||||||
static char start[0] __aligned(4) __attribute__((unused))
|
static char start[0] __aligned(4) __attribute__((unused))
|
||||||
__section(".u_boot_sandbox_getopt_start");
|
__section("_u_boot_sandbox_getopt_start");
|
||||||
|
|
||||||
return (struct sandbox_cmdline_option **)&start;
|
return (struct sandbox_cmdline_option **)&start;
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ static inline struct sandbox_cmdline_option **
|
|||||||
__u_boot_sandbox_option_end(void)
|
__u_boot_sandbox_option_end(void)
|
||||||
{
|
{
|
||||||
static char end[0] __aligned(4) __attribute__((unused))
|
static char end[0] __aligned(4) __attribute__((unused))
|
||||||
__section(".u_boot_sandbox_getopt_end");
|
__section("_u_boot_sandbox_getopt_end");
|
||||||
|
|
||||||
return (struct sandbox_cmdline_option **)&end;
|
return (struct sandbox_cmdline_option **)&end;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user