Re: [PATCH] objtool: Use idiomatic section name for relocatable rodata under PIE
From: Josh Poimboeuf
Date: Tue Feb 18 2025 - 12:38:36 EST
On Tue, Feb 18, 2025 at 10:25:39AM +0100, Ard Biesheuvel wrote:
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 91a7e824ed8b..337d3336e175 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -457,7 +457,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)
> . = ALIGN((align)); \
> .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
> __start_rodata = .; \
> - *(.rodata) *(.rodata.*) *(..rodata.*) \
> + *(.rodata) *(.rodata.*) *(.data.rel.ro*) \
If I understand correctly, this is fixing an existing bug in loongarch
and any other arches using PIE, right? And it has nothing to do with
objtool?
If so, it feels like this needs to be its own patch, described as a fix.
> SCHED_DATA \
> RO_AFTER_INIT_DATA /* Read only after init */ \
> . = ALIGN(8); \
> diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> index 3d013f1412e0..27024a128a6a 100644
> --- a/include/linux/compiler.h
> +++ b/include/linux/compiler.h
> @@ -110,7 +110,11 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
> /* Unreachable code */
> #ifdef CONFIG_OBJTOOL
> /* Annotate a C jump table to allow objtool to follow the code flow */
> -#define __annotate_jump_table __section("..rodata.c_jump_table")
> +#ifndef __pie__
> +#define __annotate_jump_table __section(".rodata.c_jump_table")
> +#else
> +#define __annotate_jump_table __section(".data.rel.ro.c_jump_table")
> +#endif
Why have two different section names, does .data.rel.ro.* not work for
non-PIE?
--
Josh