[GOLD] powerpc64 --gc-sections RFC

Alan Modra amodra@gmail.com
Fri Sep 7 00:57:00 GMT 2012


On Wed, Sep 05, 2012 at 05:31:40PM -0700, Ian Lance Taylor wrote:
> > +  // Given a reference from SRC_OBJ, SRC_INDX to a location specified
> > +  // by DST_OBJ, DST_INDX and DST_OFF, return the true destination
> > +  // section that should be marked during --gc-sections processing.
> > +
> > +  virtual unsigned int
> > +  dest_shndx(Object* /* src_obj */,
> > +            unsigned int /* src_indx */,
> > +            Object* /* dst_obj */,
> > +            unsigned int dst_indx,
> > +            typename elfcpp::Elf_types<size>::Elf_Addr /* dst_off */)
> > +  { return dst_indx; }
> 
> This should use the do_dest_shndx approach as in other virtual
> functions.  Also dest_shndx isn't the best name, perhaps something
> like gc_ref_shndx.

I've revised the patch considerably.  I now want to add the following
to Sized_target, and I'm confused about the rules.

  // Handle target specific gc actions when adding a gc reference.
  virtual void
  do_gc_add_reference(Symbol_table* /* symtab */,
		      Object* /* src_obj */,
		      unsigned int /* src_shndx */,
		      Object* /* dst_obj */,
		      unsigned int /* dst_shndx */,
		      typename elfcpp::Elf_types<size>::Elf_Addr /* dst_off */)
  { }

Does this need a gc_add_reference in Sized_target?  Or should I make
that last parameter a uint64_t and treat this function like
adjust_elf_header/do_adjust_elf_header?  Note that in this case we
will be calling the function from gc.h:gc_process_relocs which is
templated on size so I'm thinking uint32_t -> uint64_t -> uint32_t
conversions for 32-bit targets is a little unclean.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list