* [GOLD] PowerPC64 TOC indirect to TOC relative segfault
@ 2017-02-03 9:35 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2017-02-03 9:35 UTC (permalink / raw)
To: binutils
Newer versions of gcc don't create an empty .toc section.
* powerpc.cc (Powerpc_relobj::make_toc_relative): Don't crash
when no .toc section exists.
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index a67c336..4abfcec 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -1986,6 +1986,12 @@ Powerpc_relobj<size, big_endian>::make_toc_relative(
if (size != 64)
return false;
+ // With -mcmodel=medium code it is quite possible to have
+ // toc-relative relocs referring to objects outside the TOC.
+ // Don't try to look at a non-existent TOC.
+ if (this->toc_shndx() == 0)
+ return false;
+
// Convert VALUE back to an address by adding got_base (see below),
// then to an offset in the TOC by subtracting the TOC output
// section address and the TOC output offset. Since this TOC output
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-02-03 9:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-03 9:35 [GOLD] PowerPC64 TOC indirect to TOC relative segfault Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).