[GOLD] powerpc64 ODR violation check

Alan Modra amodra@gmail.com
Fri Mar 8 06:49:00 GMT 2013


On Thu, Mar 07, 2013 at 10:09:23PM -0800, Ian Lance Taylor wrote:
> On 3/7/13, Alan Modra <amodra@gmail.com> wrote:
> 
> > - Moving find_shdr to Object requires specifying template parameters
> > explicitly since the arguments don't allow a compiler to deduce them.
> > I didn't know how to do that using this->find_shdr() syntax, or if it
> > is even possible.
> 
> You just write
>     this->find_shdr<size, big_endian>(...)
> Do that instead of the Object::find_shdr approach.

I tried that.  This with gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1.
Ditto for gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)

/src/binutils-current/gold/object.cc: In member function ‘bool gold::Sized_relobj_file<size, big_endian>::find_eh_frame(const unsigned char*, const char*, gold::section_size_type) const’:
/src/binutils-current/gold/object.cc:590:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
/src/binutils-current/gold/object.cc: In member function ‘bool gold::Sized_relobj_file<size, big_endian>::find_eh_frame(const unsigned char*, const char*, gold::section_size_type) const [with int size = 32, bool big_endian = false, gold::section_size_type = long unsigned int]’:
/src/binutils-current/gold/object.cc:3209:7:   instantiated from here
/src/binutils-current/gold/object.cc:589:7: error: left operand of comma operator has no effect [-Werror=unused-value]
/src/binutils-current/gold/object.cc:589:7: error: right operand of comma operator has no effect [-Werror=unused-value]
/src/binutils-current/gold/object.cc:589:7: error: right operand of comma operator has no effect [-Werror=unused-value]
/src/binutils-current/gold/object.cc:589:7: error: right operand of comma operator has no effect [-Werror=unused-value]
/src/binutils-current/gold/object.cc:589:7: error: invalid operands of types ‘<unresolved overloaded function type>’ and ‘int’ to binary ‘operator<’

> 
> > +  // Find the section header with the given NAME.  If HDR is non-NULL
> > +  // then it is a section header returned from a previous call to this
> > +  // function and the next section header with the same name will be
> > +  // returned.
> > +  template<int size, bool big_endian>
> > +  const unsigned char*
> > +  find_shdr(const unsigned char* /*pshdrs*/, const char* /*name*/,
> > +	    const char* /*names*/, section_size_type /*names_size*/,
> > +	    const unsigned char* /*hdr*/) const;
> 
> You don't need to comment out the parameter names here.
> 
> This is OK with those changes.
> 
> Thanks.
> 
> Ian

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list