summaryrefslogtreecommitdiff
path: root/gold/target-reloc.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2011-07-09 00:47:11 +0000
committerIan Lance Taylor <ian@airs.com>2011-07-09 00:47:11 +0000
commitbc284dbd5b809c3886322333fe4ce356d1b72cd4 (patch)
tree73b4c3761589daf3ec242b97f7bf7ce9213eb5d4 /gold/target-reloc.h
parent2f253f1e97a711bb709184e68c7e43a3e439dfeb (diff)
downloadbinutils-redhat-bc284dbd5b809c3886322333fe4ce356d1b72cd4.tar.gz
PR gold/11317
* target-reloc.h (issue_undefined_symbol_error): New inline function, broken out of relocate_section. (relocate_section): Call issue_undefined_symbol_error. * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if there is no TLS segment if we are about to issue an undefined symbol error. * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
Diffstat (limited to 'gold/target-reloc.h')
-rw-r--r--gold/target-reloc.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/gold/target-reloc.h b/gold/target-reloc.h
index fc832dc6d2..fabc0a9f91 100644
--- a/gold/target-reloc.h
+++ b/gold/target-reloc.h
@@ -1,6 +1,6 @@
// target-reloc.h -- target specific relocation support -*- C++ -*-
-// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
@@ -169,6 +169,22 @@ visibility_error(const Symbol* sym)
v, sym->name());
}
+// Return true if we are should issue an error saying that SYM is an
+// undefined symbol. This is called if there is a relocation against
+// SYM.
+
+inline bool
+issue_undefined_symbol_error(const Symbol* sym)
+{
+ return (sym != NULL
+ && (sym->is_undefined() || sym->is_placeholder())
+ && sym->binding() != elfcpp::STB_WEAK
+ && !sym->is_defined_in_discarded_section()
+ && !parameters->target().is_defined_by_abi(sym)
+ && (!parameters->options().shared()
+ || parameters->options().defs()));
+}
+
// This function implements the generic part of relocation processing.
// The template parameter Relocate must be a class type which provides
// a single function, relocate(), which implements the machine
@@ -344,13 +360,7 @@ relocate_section(
continue;
}
- if (sym != NULL
- && (sym->is_undefined() || sym->is_placeholder())
- && sym->binding() != elfcpp::STB_WEAK
- && !is_defined_in_discarded_section
- && !target->is_defined_by_abi(sym)
- && (!parameters->options().shared() // -shared
- || parameters->options().defs())) // -z defs
+ if (issue_undefined_symbol_error(sym))
gold_undefined_symbol_at_location(sym, relinfo, i, offset);
else if (sym != NULL
&& sym->visibility() != elfcpp::STV_DEFAULT