public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joakim Nohlgård" <joakim@nohlgard.se>
To: Jeff Law <jeffreyalaw@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] gcc: Use ld -r when checking for HAVE_LD_RO_RW_SECTION_MIXING
Date: Mon, 5 Dec 2022 14:46:07 +0100	[thread overview]
Message-ID: <CAEVyRBLyi57e-AdF1Z5ZanQsCpxWtXFvY_MM3dUEYMKQYqQAWw@mail.gmail.com> (raw)
In-Reply-To: <c0a747ea-3a45-6bfc-c441-e0fe1fc97819@gmail.com>

On Mon, Nov 28, 2022 at 5:53 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
> On 11/28/22 06:59, Joakim Nohlgård wrote:
> > The check for HAVE_LD_RO_RW_SECTION_MIXING fails on targets where ld
> > does not support shared objects, even though the answer to the test
> > should be 'read-write'. One such target is riscv64-unknown-elf. Failing
> > this test results in a libgcc crtbegin.o which has a writable .eh_frame
> > section leading to the default linker scripts placing the .eh_frame
> > section in a writable memory segment, or a linker warning about writable
> > sections in a read-only segment when using ld scripts that place
> > .eh_frame unconditionally in ROM.
> >
> > gcc/ChangeLog:
> >
> >       * configure: Regenerate.
> >       * configure.ac: Use ld -r in the check for HAVE_LD_RO_RW_SECTION_MIXING
>
> I'm not sure that simply replacing -shared with -r is the right fix
> here.  ISTM that if the -shared tests fails, then we can/should try the
> -r variant.    Am I missing something here?
>
I have posted a v2 patch. The new patch tries ld -shared first and
falling back to ld -r if that fails.

I believe the original reason for using ld -shared in the first place
was that it was a convenient way to let the conftest1,2,3 code be as
simple as possible. Using ld without any flags would require a program
entry point (_start) at the very minimum. Using ld -r has the same
effect as the ld -shared link in this case, where we just want to
merge sections with the same name from different input files and check
what section flags were propagated to the output file.

      reply	other threads:[~2022-12-05 13:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 13:59 Joakim Nohlgård
2022-11-28 16:53 ` Jeff Law
2022-12-05 13:46   ` Joakim Nohlgård [this message]

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=CAEVyRBLyi57e-AdF1Z5ZanQsCpxWtXFvY_MM3dUEYMKQYqQAWw@mail.gmail.com \
    --to=joakim@nohlgard.se \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.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).