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: PATCH: Handle STT_GNU_IFUNC symols when building shared library


On Thu, Jan 6, 2011 at 12:59 PM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> "H.J. Lu" <hongjiu.lu@intel.com> writes:
>> I checked in this patch to properly handle local/global STT_GNU_IFUNC
>> symols when building shared library.
>
> I don't want to be a moaning so-and-so, but this patch touches things
> outside the x86 & x86_64 backends. ?Did anyone approve those changes?

I created elf-ifunc.c so that I can share the same code between i386 and
x86_64 backends.  Should I rename it to elf-ifunc-x86.c?

> I ask because you've committed the patch without any real explanation.

http://sourceware.org/ml/binutils/2011-01/msg00084.html

has

+      /* When building shared library, we need to handle the case
+         where it is marked with regular reference, but not non-GOT
+	 reference.  It may happen if we didn't see STT_GNU_IFUNC
+	 symbol at the time when checking relocations.  */
+      bfd_size_type count = 0;
+
+      if (info->shared
+	  && !h->non_got_ref
+	  && h->ref_regular)
+	{
+	  for (p = *head; p != NULL; p = p->next)
+	    count += p->count;
+	  if (count != 0)
+	    h->non_got_ref = 1;
+	}
+
+      if (count == 0)
+	{
+	  h->got = htab->init_got_offset;
+	  h->plt = htab->init_plt_offset;
+	  *head = NULL;
+	  return TRUE;
+	}
     }


> What do you think about the point raised in 12366: that it's not really
> meaningful to test def_regular in check_relocs, because the value
> doesn't take into account later objects? ?check_relocs and the
> setting of def_regular are both part of elf_link_add_object_symbols.
>

That is probably true.  However, unless there is a testcase to show
it is wrong to do so, I don't want to change it.

Thanks.


-- 
H.J.


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