This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

PPC64 LE bootstrap hack 2/2 - Make static linker rewrite GLIBC_2.18 deps as GLIBC_2.17.


On 02/05/2014 04:29 PM, Andreas Schwab wrote:
> Adam Conrad <adconrad@0c3.net> writes:
> 
>> On Wed, Feb 05, 2014 at 02:55:43PM -0500, Carlos O'Donell wrote:
>>>
>>> Working with Adhemerval we discovered that we need a binutils
>>> patch to do the equivalent action but for the static linker.
> 
> Injecting a cross-compiled libgcc_s.so and libstdc++.so should be enough
> to get things started.

Or you can hack the static linker.

This is the second hack required to make the bootstrap work.

Please find attached the binutils ld patch that causes the static
linker to rewrite *ALL* dependencies on @GLIBC_2.18 as if they were
dependencies on @GLIBC_2.17.

This has a *HUGE* caveat. In that a program that depends on the
6 symbols we added specifically in 2.18, and which should be
@GLIBC_2.18 and never @GLIBC_2.17 will fail to build with link
failures.

That is to say any pre-existing library that you link against
that references:
__cxa_thread_atexit_impl (thread_local destructor support from new gcc)
__issignaling
__issignalingf
__issignalingl
pthread_getattr_default_np
pthread_setattr_default_np
will be rewritten incorrectly and will fail to link correctly.

That means that you might get 90-95% of the distro rebuilt with
this binutils ld hack, but then at that point you have to backout
all the hacks and build the last 5% iteratively or by hand. The
expectation is that no core package will use the above 6 symbols.

There is never a chance of a silent wrong link here as far as I know,
but ld does have some esoteric flags so I can't guarantee that.

If you really want to be more precise with this hack, you could,
in the code just above this, look for the 6 symbols specifically,
and then and only then rewrite the dependency if it isn't one of
them.

The same problem arises if you have GLIBC_2.19, but thankfully we
didn't add any symbols in 2.19.

bfd/
2014-02-05  Carlos O'Donell  <carlos@redhat.com>

	* elf.c (_bfd_elf_slurp_version_tables): Rewrite vernaux
	entries for GLIBC_2.18 to GLIBC_2.17.

diff --git a/bfd/elf.c b/bfd/elf.c
index c0303fc..7ff9acb 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -7252,6 +7252,13 @@ error_return_verref:
 
 	      if (ivernaux->vna_other > freeidx)
 		freeidx = ivernaux->vna_other;
+
+	      /* HACK: Rewrite all GLIBC_2.18 version dependencies as GLIBC_2.17.  */
+	      if (strcmp (ivernaux->vna_nodename, "GLIBC_2.18") == 0)
+		{
+		  ((char *)ivernaux->vna_nodename)[9] = '7';
+		  ivernaux->vna_hash = bfd_elf_hash (ivernaux->vna_nodename);
+		}
 	    }
 
 	  if (i + 1 < hdr->sh_info)
---

Cheers,
Carlos.


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