This is the mail archive of the 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: problem with binutils 2.29 for microblaze

On 08/08/2017 02:29 AM, Alan Modra wrote:
On Sun, Aug 06, 2017 at 10:21:27AM +0930, Alan Modra wrote:
On Sat, Aug 05, 2017 at 08:04:18PM +0200, Waldemar Brodkorb wrote:

This issue was reported in Januar:

I reported the musl build failure via IRC to Rich.
He opened up the ticket and suggested a fix.
The fix is included in Binutils 2.29.

Unfortunately it breaks uClibc-ng shared library loader.

Yes, the binutils patch is incorrect.  It causes got.refcount to be
incremented for a GOTOFF relocation, when such relocations should not
cause a GOT entry to be created.  Easily fixed.

I may as well commit the patch to fix the GOTOFF problem.  I've
verified that it builds without _NONE relocs.

	PR 21017
	* elf32-microblaze.c (microblaze_elf_check_relocs): Don't bump
	got.refcount for GOTOFF relocs, just create .got section.

diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index 2657736..94ef09e 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -2353,7 +2353,6 @@ microblaze_elf_check_relocs (bfd * abfd,
            sec->has_tls_reloc = 1;
  	  /* Fall through.  */
-        case R_MICROBLAZE_GOTOFF_64:
          case R_MICROBLAZE_GOT_64:
            if (htab->elf.sgot == NULL)
@@ -2374,6 +2373,17 @@ microblaze_elf_check_relocs (bfd * abfd,
+	  if (htab->elf.sgot == NULL)
+	    {
+	      if (htab->elf.dynobj == NULL)
+		htab->elf.dynobj = abfd;
+	      if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
+		return FALSE;
+	    }
+	  break;
          case R_MICROBLAZE_64:
          case R_MICROBLAZE_64_PCREL:
          case R_MICROBLAZE_32:

OK with me.

Michael Eager
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

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