X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gold%2Ftls.h;h=5b5cb6ea88c055330d93d2a8de40a27143b9de6a;hb=7903e5309890633911c91539e23a407e1f74b959;hp=9324701c105c73115fee390d4a76bac3abea8f9a;hpb=af6359d59d84cdd70fd1f400b91bc2fdcbed7dfa;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/tls.h b/gold/tls.h index 9324701c10..5b5cb6ea88 100644 --- a/gold/tls.h +++ b/gold/tls.h @@ -1,6 +1,6 @@ // tls.h -- Thread-Local Storage utility routines for gold -*- C++ -*- -// Copyright 2006, 2007 Free Software Foundation, Inc. +// Copyright 2006, 2007, 2008 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -50,16 +50,13 @@ inline void check_range(const Relocate_info* relinfo, size_t relnum, typename elfcpp::Elf_types::Elf_Addr rel_offset, - off_t view_size, off_t off) + section_size_type view_size, int off) { - off_t offset = rel_offset + off; - if (offset < 0 || offset > view_size) - { - fprintf(stderr, _("%s: %s: TLS relocation out of range\n"), - program_name, - relinfo->location(relnum, rel_offset).c_str()); - gold_exit(false); - } + typename elfcpp::Elf_types::Elf_Addr offset = rel_offset + off; + // Elf_Addr is unsigned, so this also tests for signed offset < 0. + if (offset > view_size) + gold_error_at_location(relinfo, relnum, rel_offset, + _("TLS relocation out of range")); } // Check the validity of a TLS relocation. This is like assert. @@ -72,13 +69,8 @@ check_tls(const Relocate_info* relinfo, bool valid) { if (!valid) - { - fprintf(stderr, - _("%s: %s: TLS relocation against invalid instruction\n"), - program_name, - relinfo->location(relnum, rel_offset).c_str()); - gold_exit(false); - } + gold_error_at_location(relinfo, relnum, rel_offset, + _("TLS relocation against invalid instruction")); }