Re: [PATCH v2] kbuild: exclude .rodata.(cst|str)* when building ranges

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Mar 8, 2025 at 1:54 AM Kris Van Hees <kris.van.hees@xxxxxxxxxx> wrote:
>
> The .rodata.(cst|str)* sections are often resized during the final
> linking and since these sections do not cover actual symbols there is
> no need to include them in the modules.builtin.ranges data.
>
> When these sections were included in processing and resizing occurred,
> modules were reported with ranges that extended beyond their true end,
> causing subsequent symbols (in address order) to be associated with
> the wrong module.
>
> Fixes: 5f5e7344322f ("kbuild: generate offset range data for builtin modules")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Kris Van Hees <kris.van.hees@xxxxxxxxxx>
> Reviewed-by: Jack Vogel <jack.vogel@xxxxxxxxxx>
> ---

Applied to linux-kbuild. Thanks.

>  scripts/generate_builtin_ranges.awk | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/scripts/generate_builtin_ranges.awk b/scripts/generate_builtin_ranges.awk
> index b9ec761b3bef..d4bd5c2b998c 100755
> --- a/scripts/generate_builtin_ranges.awk
> +++ b/scripts/generate_builtin_ranges.awk
> @@ -282,6 +282,11 @@ ARGIND == 2 && !anchor && NF == 2 && $1 ~ /^0x/ && $2 !~ /^0x/ {
>  # section.
>  #
>  ARGIND == 2 && sect && NF == 4 && /^ [^ \*]/ && !($1 in sect_addend) {
> +       # There are a few sections with constant data (without symbols) that
> +       # can get resized during linking, so it is best to ignore them.
> +       if ($1 ~ /^\.rodata\.(cst|str)[0-9]/)
> +               next;
> +
>         if (!($1 in sect_base)) {
>                 sect_base[$1] = base;
>
> --
> 2.45.2
>


-- 
Best Regards
Masahiro Yamada





[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux