public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Szabolcs Nagy <szabolcs.nagy@arm.com>,
	 libc-alpha@sourceware.org,
	Joseph Myers <joseph@codesourcery.com>,
	 Fangrui Song <maskray@google.com>
Subject: Re: x86_64 / i686 no-PIE failures
Date: Fri, 04 Nov 2022 17:52:51 +0100	[thread overview]
Message-ID: <87iljuzmos.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAMe9rOoUxw0cr4w9+qL++fHtpBETDxLzcbCujMhRGsEsZSTY=A@mail.gmail.com> (H. J. Lu's message of "Fri, 4 Nov 2022 09:48:37 -0700")

* H. J. Lu:

> On Fri, Nov 4, 2022 at 2:29 AM Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
>>
>> The 11/04/2022 08:12, Florian Weimer via Libc-alpha wrote:
>> > * Joseph Myers:
>> >
>> > > Now that the uchar.h failures with mainline GCC are fixed, other failures
>> > > show up for x86_64 / i686 no-PIE with mainline GCC and binutils (I don't
>> > > know how long these have been there):
>> > >
>> > > /scratch/jmyers/glibc-bot/install/compilers/x86_64-linux-gnu/lib/gcc/x86_64-glibc-linux-gnu/13.0.0/../../../../x86_64-glibc-linux-gnu/bin/ld: /scratch/jmyers/glibc-bot/build/glibcs/x86_64-linux-gnu-no-pie/glibc/elf/ifuncmain1.o: non-canonical reference to canonical protected function `foo_protected' in /scratch/jmyers/glibc-bot/build/glibcs/x86_64-linux-gnu-no-pie/glibc/elf/ifuncmod1.so
>> > > /scratch/jmyers/glibc-bot/install/compilers/x86_64-linux-gnu/lib/gcc/x86_64-glibc-linux-gnu/13.0.0/../../../../x86_64-glibc-linux-gnu/bin/ld: failed to set dynamic section sizes: bad value
>> > > collect2: error: ld returned 1 exit status
>> > > ../Rules:238: recipe for target '/scratch/jmyers/glibc-bot/build/glibcs/x86_64-linux-gnu-no-pie/glibc/elf/ifuncmain1' failed
>> > > make[3]: *** [/scratch/jmyers/glibc-bot/build/glibcs/x86_64-linux-gnu-no-pie/glibc/elf/ifuncmain1] Error 1
>> > > make[3]: Leaving directory '/scratch/jmyers/glibc-bot/src/glibc/elf'
>> >
>> > H.J.,
>> >
>> > this test no longer seems valid with current binutils (or current
>> > binutils is broken).
>> >
>> > ifuncmain1.o has X86_64_32S and X86_64_PLT32 relocations for
>> > foo_protected, so the main program must contain a PLT stub for
>> > foo_protected.  Apparently, ld no longer produces such binaries.
>> >
>> > What should we do about this?
>>
>> aarch64 has the same issue since
>>
>>   binutils commit 90b7a5df152a64d2bea20beb438e8b81049a5c30
>>   aarch64: Disallow copy relocations on protected data
>>
>> which should be in the binutils 2.39 release
>>
>> ld.lld rejects such usage too, i think the plan was to not
>> support extern protected symbol refs with canonical address
>> moved to the main exe.
>>
>> so the tests should be changed, but i'm not sure what's
>> the best approach (completely dropping protected or just
>> ensure the address is not taken in no-pie case).
>
> Given the linker change, we should drop these tests for non-PIE.

If we don't take the address of foo_protected, we'd only have an
X86_64_PLT32 relocation.  Would that be valid from a linker perspective?

Thanks,
Florian


  reply	other threads:[~2022-11-04 16:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 22:27 Joseph Myers
2022-11-04  7:12 ` Florian Weimer
2022-11-04  9:28   ` Szabolcs Nagy
2022-11-04 16:48     ` H.J. Lu
2022-11-04 16:52       ` Florian Weimer [this message]
2022-11-04 17:28         ` Fangrui Song
2022-11-04 17:47           ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87iljuzmos.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=maskray@google.com \
    --cc=szabolcs.nagy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).