This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PPC64 LE bootstrap hack 2/2 - Make static linker rewrite GLIBC_2.18 deps as GLIBC_2.17.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>, Adam Conrad <adconrad at 0c3 dot net>
- Cc: Michael Matz <matz at suse dot de>, Andreas Jaeger <aj at suse dot com>, Steven Munroe <sjmunroe at us dot ibm dot com>, Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>, Brent Baude <baude at us dot ibm dot com>, Siddhesh Poyarekar <siddhesh at redhat dot com>, Jeff Law <law at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>, Matt Newsome <mnewsome at redhat dot com>
- Date: Wed, 05 Feb 2014 21:42:06 -0500
- Subject: PPC64 LE bootstrap hack 2/2 - Make static linker rewrite GLIBC_2.18 deps as GLIBC_2.17.
- Authentication-results: sourceware.org; auth=none
- References: <52EB617D dot 1000609 at redhat dot com> <52F2973F dot 1060409 at redhat dot com> <20140205201154 dot GX15976 at 0c3 dot net> <8738jxb651 dot fsf at igel dot home>
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.