From 87163b019612d5aa3a2ea5b90f0012baa2059d19 Mon Sep 17 00:00:00 2001 From: christos Date: Sun, 3 Sep 2023 18:45:26 +0000 Subject: [PATCH] remap generated ubsan filename string labels. fixes reproducible builds. reported by wiz@ --- external/gpl3/gcc.old/dist/gcc/ubsan.c | 6 ++++-- external/gpl3/gcc/dist/gcc/ubsan.cc | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/external/gpl3/gcc.old/dist/gcc/ubsan.c b/external/gpl3/gcc.old/dist/gcc/ubsan.c index c55a24e93168..bb26088cdfe0 100644 --- a/external/gpl3/gcc.old/dist/gcc/ubsan.c +++ b/external/gpl3/gcc.old/dist/gcc/ubsan.c @@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfg.h" #include "gimple-fold.h" #include "varasm.h" +#include "file-prefix-map.h" /* Map from a tree to a VAR_DECL tree. */ @@ -304,8 +305,9 @@ ubsan_source_location (location_t loc) else { /* Fill in the values from LOC. */ - size_t len = strlen (xloc.file) + 1; - str = build_string (len, xloc.file); + const char *file = remap_debug_filename (xloc.file); + size_t len = strlen (file) + 1; + str = build_string (len, file); TREE_TYPE (str) = build_array_type_nelts (char_type_node, len); TREE_READONLY (str) = 1; TREE_STATIC (str) = 1; diff --git a/external/gpl3/gcc/dist/gcc/ubsan.cc b/external/gpl3/gcc/dist/gcc/ubsan.cc index 0f5b372b195f..224993a0b91e 100644 --- a/external/gpl3/gcc/dist/gcc/ubsan.cc +++ b/external/gpl3/gcc/dist/gcc/ubsan.cc @@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfg.h" #include "gimple-fold.h" #include "varasm.h" +#include "file-prefix-map.h" /* Map from a tree to a VAR_DECL tree. */ @@ -304,8 +305,9 @@ ubsan_source_location (location_t loc) else { /* Fill in the values from LOC. */ - size_t len = strlen (xloc.file) + 1; - str = build_string (len, xloc.file); + const char *file = remap_debug_filename (xloc.file); + size_t len = strlen (file) + 1; + str = build_string (len, file); TREE_TYPE (str) = build_array_type_nelts (char_type_node, len); TREE_READONLY (str) = 1; TREE_STATIC (str) = 1;