[PATCH GOLD] [1/N mingw host] fix up off_t usage

Andrew Pinski Andrew_Pinski@playstation.sony.com
Tue Oct 6 23:59:00 GMT 2009


Hi,
  On mingw and most likely other targets that currently don't support
large file support, currently the build fails with warnings about
comparisons between unsigned and signed types.

Ok?  Built and tested on i686-linux-gnu.  Note I don't have cvs write
access currently.

Thanks,
Andrew Pinski

elfcpp/elfcpp_file.h (Elf_file::section_name): Correct type of shstr_off.

gold/ChangeLog:

* dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
Change read_shndx type to unsigned int.
(Sized_dwarf_line_info::read_lines): Change shndx type to unsigned int.
(Sized_dwarf_line_info::read_line_mappings): Likewise.
* dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
Change read_shndx type to unsigned int.
(Sized_dwarf_line_info::read_lines): Change shndx type to unsigned int.
(Sized_dwarf_line_info::read_line_mappings): Likewise.
* layout.cc (Layout::create_symtab_sections): Cast the result of
local_symcount * symsize to off_t in the gold_assert.
-------------- next part --------------
Index: dwarf_reader.cc
===================================================================
RCS file: /cvs/src/src/gold/dwarf_reader.cc,v
retrieving revision 1.22
diff -u -p -r1.22 dwarf_reader.cc
--- dwarf_reader.cc	28 May 2008 20:48:16 -0000	1.22
+++ dwarf_reader.cc	6 Oct 2009 23:48:53 -0000
@@ -129,7 +129,7 @@ ResetLineStateMachine(struct LineStateMa
 
 template<int size, bool big_endian>
 Sized_dwarf_line_info<size, big_endian>::Sized_dwarf_line_info(Object* object,
-                                                               off_t read_shndx)
+                                                               unsigned int read_shndx)
   : data_valid_(false), buffer_(NULL), symtab_buffer_(NULL),
     directories_(), files_(), current_header_index_(-1)
 {
@@ -508,7 +508,7 @@ Sized_dwarf_line_info<size, big_endian>:
 template<int size, bool big_endian>
 unsigned const char*
 Sized_dwarf_line_info<size, big_endian>::read_lines(unsigned const char* lineptr,
-                                                    off_t shndx)
+                                                    unsigned int shndx)
 {
   struct LineStateMachine lsm;
 
@@ -595,7 +595,7 @@ Sized_dwarf_line_info<size, big_endian>:
 template<int size, bool big_endian>
 void
 Sized_dwarf_line_info<size, big_endian>::read_line_mappings(Object* object,
-							    off_t shndx)
+							    unsigned int shndx)
 {
   gold_assert(this->data_valid_ == true);
 
Index: dwarf_reader.h
===================================================================
RCS file: /cvs/src/src/gold/dwarf_reader.h,v
retrieving revision 1.15
diff -u -p -r1.15 dwarf_reader.h
--- dwarf_reader.h	28 May 2008 20:48:16 -0000	1.15
+++ dwarf_reader.h	6 Oct 2009 23:48:53 -0000
@@ -105,7 +105,7 @@ class Sized_dwarf_line_info : public Dwa
   // Initializes a .debug_line reader for a given object file.
   // If SHNDX is specified and non-negative, only read the debug
   // information that pertains to the specified section.
-  Sized_dwarf_line_info(Object* object, off_t read_shndx = -1U);
+  Sized_dwarf_line_info(Object* object, unsigned int read_shndx = -1U);
 
  private:
   std::string
@@ -115,7 +115,7 @@ class Sized_dwarf_line_info : public Dwa
   // If SHNDX is non-negative, only store debug information that
   // pertains to the specified section.
   void
-  read_line_mappings(Object*, off_t shndx);
+  read_line_mappings(Object*, unsigned int shndx);
 
   // Reads the relocation section associated with .debug_line and
   // stores relocation information in reloc_map_.
@@ -140,7 +140,7 @@ class Sized_dwarf_line_info : public Dwa
   // discard all line information that doesn't pertain to the given
   // section.
   const unsigned char*
-  read_lines(const unsigned char* lineptr, off_t shndx);
+  read_lines(const unsigned char* lineptr, unsigned int shndx);
 
   // Process a single line info opcode at START using the state
   // machine at LSM.  Return true if we should define a line using the
Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.135
diff -u -p -r1.135 layout.cc
--- layout.cc	18 Sep 2009 01:10:38 -0000	1.135
+++ layout.cc	6 Oct 2009 23:48:53 -0000
@@ -2542,7 +2542,7 @@ Layout::create_symtab_sections(const Inp
     }
 
   unsigned int local_symcount = local_symbol_index;
-  gold_assert(local_symcount * symsize == off - startoff);
+  gold_assert((off_t)(local_symcount * symsize) == off - startoff);
 
   off_t dynoff;
   size_t dyn_global_index;


More information about the Binutils mailing list