Bug 14570 - Gold is broken for x32
Summary: Gold is broken for x32
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.24
: P2 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-12 17:10 UTC by H.J. Lu
Modified: 2012-09-12 19:14 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2012-09-12 17:10:35 UTC
This commit:

http://sourceware.org/git/?p=binutils.git;a=commit;h=f1a44d332b9e891b517c6397f76d06dfd47abbdd

has

@@ -1409,19 +1414,24 @@ Output_data_got<size, big_endian>::Got_entry::write(unsigned char* pov) const
 
     default:
       {
-       const Relobj* object = this->u_.object;
+       const Sized_relobj_file<size, big_endian>* object
+         = static_cast<Sized_relobj_file<size, big_endian>*>(this->u_.object);
         const unsigned int lsi = this->local_sym_index_;

But Output_data_got is declared as:

template<int got_size, bool big_endian>
class Output_data_got : public Output_data_got_base
{
 public:
  typedef typename elfcpp::Elf_types<got_size>::Elf_Addr Valtype;

The template size parameter is for GOT size, which
is independent of the template size parameter for

// A regular object file.  This is size and endian specific.

template<int size, bool big_endian>
class Sized_relobj_file : public Sized_relobj<size, big_endian>
{

It is wrong to use GOT size a template parameter for Sized_relobj_file.
Comment 1 Sourceware Commits 2012-09-12 18:29:24 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2012-09-12 18:29:19

Modified files:
	gold           : ChangeLog incremental.h object.h output.cc 

Log message:
	PR gold/14570
	* output.cc: Rename Output_data_got template parameter from size
	to got_size for all functions.  Compile all variants of
	Output_data_got.
	(Output_data_got::Got_entry::write): Correct use of size for
	symbol value.  Use local_is_tls rather than casting to
	Sized_relobj_file.
	* object.h (class Object): Add local_is_tls and do_local_is_tls.
	(class Sized_relobj_file): Add do_local_is_tls.
	* incremental.h (class Sized_relobj_incr): Add do_local_is_tls.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.957&r2=1.958
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/incremental.h.diff?cvsroot=src&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/object.h.diff?cvsroot=src&r1=1.119&r2=1.120
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/output.cc.diff?cvsroot=src&r1=1.173&r2=1.174
Comment 2 H.J. Lu 2012-09-12 19:14:28 UTC
Fixed.