crosstool-ng/packages/binutils/2.37/0016-pr28417-std-string-no-longer-allows-accepting-nullptr_t.patch
Hans-Christian Noren Egtvedt 5a4c95d658 binutils-2.37: add more patches from upstream release branch
Fetch in various patches from binutils-2_37-branch upstream.

The most vital change is the
0012-pr28391-strip-objcopy-preserve-dates-a-cannot-set-time.patch which
allows building large upstream projects like Qt WebEngine without need
100k's of file descriptors open.

Signed-off-by: Hans-Christian Noren Egtvedt <hegtvedt@cisco.com>
2022-02-04 09:55:25 +13:00

46 lines
1.4 KiB
Diff

From 0effb90eb7c9a50408d98ce174f1b4bc5562f017 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 20 Oct 2021 10:09:57 +1030
Subject: [PATCH] PR28417, std::string no longer allows accepting nullptr_t
PR 28417
* incremental.cc (Sized_relobj_incr::do_section_name): Avoid
std:string undefined behaviour.
* options.h (Search_directory::Search_directory): Likewise.
(cherry picked from commit 068a039b8bd7c7386bb0d88f0ae245b0fe4132e9)
---
gold/incremental.cc | 2 +-
gold/options.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gold/incremental.cc b/gold/incremental.cc
index 52941985e6f..327a1527a29 100644
--- a/gold/incremental.cc
+++ b/gold/incremental.cc
@@ -2286,7 +2286,7 @@ Sized_relobj_incr<size, big_endian>::do_section_name(unsigned int shndx) const
const Output_sections& out_sections(this->output_sections());
const Output_section* os = out_sections[shndx];
if (os == NULL)
- return NULL;
+ return std::string();
return os->name();
}
diff --git a/gold/options.h b/gold/options.h
index 757ebf18fec..47299a37834 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -611,7 +611,7 @@ class Search_directory
// We need a default constructor because we put this in a
// std::vector.
Search_directory()
- : name_(NULL), put_in_sysroot_(false), is_in_sysroot_(false)
+ : name_(), put_in_sysroot_(false), is_in_sysroot_(false)
{ }
// This is the usual constructor.
--
2.27.0