[PATCH] gas: improve reproducibility for stabs debugging data format

Denys Zagorui -X (dzagorui - GLOBALLOGIC INC at Cisco) dzagorui@cisco.com
Mon Nov 9 13:41:48 GMT 2020


> powerpc 32bit Linux Kernel widely uses .stabs pseudo-op to
> produce debugging information in stabs format. Faced an issue
> that during Linux Kernel build with Yocto build system for 32bit
> powerpc platform resulting vmlinux contains absolute path in
> .stabstr section that cannot be remapped with -fdebug-prefix-map
> option.
>
> Yocto uses scripts/mkmakefile Linux Kernel build approach that
> allows to store all generated files outside of kernel source
> tree. With this approach each compilier invocation is performed
> with an absolute path to a file that will be compiled and this
> absolute path is recorded in init stab. There is no way to remap
> this path.
>
> Reuse remap_debug_filename api to make -fdebug-prefix-map flag
> aplicable for init stab.
>
> 2020-11-21  Denys Zagorui  <dzagorui@cisco.com>  (tiny change)
>
>         * config/obj-elf (obj_elf_init_stab_section): Improve
>         reproducibility for stabs debugging data format
>
> Signed-off-by: Denys Zagorui <dzagorui@cisco.com>
> ---
> gas/ChangeLog        | 5 +++++
> gas/config/obj-elf.c | 3 ++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/gas/ChangeLog b/gas/ChangeLog
> index 3c2d6891dc..8db46458df 100644
> --- a/gas/ChangeLog
> +++ b/gas/ChangeLog
> @@ -1,3 +1,8 @@
> +2020-11-21  Denys Zagorui  <dzagorui@cisco.com>  (tiny change)
> +
> +       * config/obj-elf (obj_elf_init_stab_section): Improve
> +       reproducibility for stabs debugging data format
> +
>  2020-11-03  Christian Eggers  <ceggers@gmx.de>
>
>         * config/obj-elf (elf_frob_symbol): Fix symbol value calculation
> diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
> index 93eb81e98a..7aed8129bc 100644
> --- a/gas/config/obj-elf.c
> +++ b/gas/config/obj-elf.c
> @@ -2425,12 +2425,13 @@ obj_elf_init_stab_section (segT seg)
>    p = frag_more (12);
>    /* Zero it out.  */
>    memset (p, 0, 12);
> -  file = as_where (NULL);
> +  file = remap_debug_filename (as_where (NULL));
>    stabstr_name = concat (segment_name (seg), "str", (char *) NULL);
>    stroff = get_stab_string_offset (file, stabstr_name, TRUE);
>    know (stroff == 1 || (stroff == 0 && file[0] == '\0'));
>    md_number_to_chars (p, stroff, 4);
>    seg_info (seg)->stabu.p = p;
> +  xfree ((char *) file);
>  }
>
>  #endif
> --
> 2.23.1



More information about the Binutils mailing list