remap generated ubsan filename string labels. fixes reproducible builds.

reported by wiz@
This commit is contained in:
christos 2023-09-03 18:45:26 +00:00
parent 4739e28d31
commit 87163b0196
2 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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;