* [gold commit] PR 16111: Fix failure to diagnose GOTOFF relocation to undef symbol in shared lib (i386)
@ 2016-03-27 23:14 Cary Coutant
0 siblings, 0 replies; only message in thread
From: Cary Coutant @ 2016-03-27 23:14 UTC (permalink / raw)
To: Binutils
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
R_386_GOTOFF cannot be used to reference a non-local symbol. Gold was
not diagnosing this error.
-cary
2016-03-27 Cary Coutant <ccoutant@gmail.com>
gold/
PR gold/16111
* i386.cc (Target_i386): Add check for fully-resolved symbol for
R_386_GOTOFF.
[-- Attachment #2: pr16111.patch --]
[-- Type: application/octet-stream, Size: 1374 bytes --]
Fix failure to diagnose GOTOFF relocation to undef symbol in shared lib (i386).
2016-03-27 Cary Coutant <ccoutant@gmail.com>
gold/
PR gold/16111
* i386.cc (Target_i386): Add check for fully-resolved symbol for
R_386_GOTOFF.
diff --git a/gold/i386.cc b/gold/i386.cc
index 8bcd44e..8aaa2a8 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -2394,6 +2394,23 @@ Target_i386::Scan::global(Symbol_table* symtab,
break;
case elfcpp::R_386_GOTOFF:
+ // A GOT-relative reference must resolve locally.
+ if (!gsym->is_defined())
+ gold_error(_("%s: relocation R_386_GOTOFF against undefined symbol %s"
+ " cannot be used when making a shared object"),
+ object->name().c_str(), gsym->name());
+ else if (gsym->is_from_dynobj())
+ gold_error(_("%s: relocation R_386_GOTOFF against external symbol %s"
+ " cannot be used when making a shared object"),
+ object->name().c_str(), gsym->name());
+ else if (gsym->is_preemptible())
+ gold_error(_("%s: relocation R_386_GOTOFF against preemptible symbol %s"
+ " cannot be used when making a shared object"),
+ object->name().c_str(), gsym->name());
+ // We need a GOT section.
+ target->got_section(symtab, layout);
+ break;
+
case elfcpp::R_386_GOTPC:
// We need a GOT section.
target->got_section(symtab, layout);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-03-27 23:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-27 23:14 [gold commit] PR 16111: Fix failure to diagnose GOTOFF relocation to undef symbol in shared lib (i386) Cary Coutant
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).