This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sparc gold support...


From: Ian Lance Taylor <iant@google.com>
Date: Wed, 02 Apr 2008 14:02:47 -0700

> Thanks for the analysis.  I really should have thought of that, but it
> never occurred to me.
> 
> I just committed the appended patch which should fix this.  I added an
> aligned parameter to the get_view and get_lasting_view functions which
> indicates whether the caller needs aligned data.  The initial file
> offset is also passed down separately from the offset within the file;
> this is used to see whether any alignment is required.  We then record
> for each View how much the data has been shifted.  Let me know what
> happens--you should be able to test it with a cross-linker running on
> a SPARC host.

My Sparc32 target is half-way functional so I can test using that,
thanks!

BTW, we should not do this alignment hassle for things like string
sections where the alignment really doesn't matter even on platforms
like SPARC.

I didn't look at your changes directly yet, and I imagine you probably
took care about such issues already :-)

I put in a similar hack so that I could continue my SPARC target
development, and when doing so I found next that the Dwarf ELF type
accessors need to use the unaligned variants.

Something like this:

2008-04-02  David S. Miller  <davem@davemloft.net>

	*  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
	Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.

--- dwarf_reader.cc.~1.18.~	2008-03-26 16:36:46.000000000 -0700
+++ dwarf_reader.cc	2008-03-30 23:58:07.000000000 -0700
@@ -185,7 +185,7 @@ const unsigned char*
 Sized_dwarf_line_info<size, big_endian>::read_header_prolog(
     const unsigned char* lineptr)
 {
-  uint32_t initial_length = elfcpp::Swap<32, big_endian>::readval(lineptr);
+  uint32_t initial_length = elfcpp::Swap_unaligned<32, big_endian>::readval(lineptr);
   lineptr += 4;
 
   // In DWARF2/3, if the initial length is all 1 bits, then the offset
@@ -193,7 +193,7 @@ Sized_dwarf_line_info<size, big_endian>:
   if (initial_length == 0xffffffff)
     {
       header_.offset_size = 8;
-      initial_length = elfcpp::Swap<64, big_endian>::readval(lineptr);
+      initial_length = elfcpp::Swap_unaligned<64, big_endian>::readval(lineptr);
       lineptr += 8;
     }
   else
@@ -203,13 +203,13 @@ Sized_dwarf_line_info<size, big_endian>:
 
   gold_assert(lineptr + header_.total_length <= buffer_end_);
 
-  header_.version = elfcpp::Swap<16, big_endian>::readval(lineptr);
+  header_.version = elfcpp::Swap_unaligned<16, big_endian>::readval(lineptr);
   lineptr += 2;
 
   if (header_.offset_size == 4)
-    header_.prologue_length = elfcpp::Swap<32, big_endian>::readval(lineptr);
+    header_.prologue_length = elfcpp::Swap_unaligned<32, big_endian>::readval(lineptr);
   else
-    header_.prologue_length = elfcpp::Swap<64, big_endian>::readval(lineptr);
+    header_.prologue_length = elfcpp::Swap_unaligned<64, big_endian>::readval(lineptr);
   lineptr += header_.offset_size;
 
   header_.min_insn_length = *lineptr;
@@ -394,7 +394,7 @@ Sized_dwarf_line_info<size, big_endian>:
     case elfcpp::DW_LNS_fixed_advance_pc:
       {
         int advance_address;
-        advance_address = elfcpp::Swap<16, big_endian>::readval(start);
+        advance_address = elfcpp::Swap_unaligned<16, big_endian>::readval(start);
         oplen += 2;
         lsm->address += advance_address;
       }
@@ -432,7 +432,7 @@ Sized_dwarf_line_info<size, big_endian>:
 
           case elfcpp::DW_LNE_set_address:
             {
-              lsm->address = elfcpp::Swap<size, big_endian>::readval(start);
+              lsm->address = elfcpp::Swap_unaligned<size, big_endian>::readval(start);
               typename Reloc_map::const_iterator it
                   = reloc_map_.find(start - this->buffer_);
               if (it != reloc_map_.end())


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]