aboutsummaryrefslogtreecommitdiff
path: root/bfd/xcofflink.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-04-17 21:09:34 +0000
committerIan Lance Taylor <ian@airs.com>1996-04-17 21:09:34 +0000
commitf97fca7872e4a9636b47eefb4f64f5bdc2802443 (patch)
tree4b7420233f00ebf40eca6a2d185d3bd19a5ea81d /bfd/xcofflink.c
parentd4d3c7adbb45714fb2d1ddc7a94627729bf0a82a (diff)
downloadgdb-f97fca7872e4a9636b47eefb4f64f5bdc2802443.zip
gdb-f97fca7872e4a9636b47eefb4f64f5bdc2802443.tar.gz
gdb-f97fca7872e4a9636b47eefb4f64f5bdc2802443.tar.bz2
* xcofflink.c (xcoff_link_input_bfd): Check for TOC overflow.
Diffstat (limited to 'bfd/xcofflink.c')
-rw-r--r--bfd/xcofflink.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index 681e1e2..ed4c2b8 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -3989,11 +3989,20 @@ xcoff_link_input_bfd (finfo, input_bfd)
of the TOC using a 16 bit offset from tocval. This
test assumes that the TOC comes at the end of the
output section, as it does in the default linker
- script. If the TOC anchor is too far into the .toc
- section, the relocation routine will report
- overflows. */
+ script. */
+
tocend = ((*csectpp)->output_section->vma
+ (*csectpp)->output_section->_raw_size);
+
+ if (tocval + 0x10000 < tocend)
+ {
+ (*_bfd_error_handler)
+ ("TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling",
+ (unsigned long) (tocend - tocval));
+ bfd_set_error (bfd_error_file_too_big);
+ return false;
+ }
+
if (tocval + 0x8000 < tocend)
{
bfd_vma tocadd;