mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: another armv7-m exception handling problem
Date: Mon, 21 Oct 2019 15:29:37 -0400	[thread overview]
Message-ID: <20191021192937.GJ16318@brightrain.aerifal.cx> (raw)
In-Reply-To: <20191021190857.GR7832@port70.net>

On Mon, Oct 21, 2019 at 09:08:57PM +0200, Szabolcs Nagy wrote:
> * Rich Felker <dalias@libc.org> [2019-10-21 15:03:18 -0400]:
> > On Mon, Oct 21, 2019 at 08:09:56PM +0200, Szabolcs Nagy wrote:
> > > * Patrick Oppenlander <patrick.oppenlander@gmail.com> [2019-10-21 15:43:40 +1100]:
> > > > Not sure if this is a musl, gcc or ld bug.
> > > > 
> > > > Running gcc-8.3.0 musl 1.1.24 static pie.
> > > 
> > > providing binutils version number is useful if there is
> > > a chance that it's an ld bug.
> > > 
> > > this seems to be
> > > https://sourceware.org/bugzilla/show_bug.cgi?id=22269
> > > 
> > > which was supposed to be fixed by
> > > https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=95b03e4ad68e7a90f5096b47df595636344b783a
> > > 
> > > but apperently there are still missing cases.
> > > (it does not help that the ld test for this bug
> > > greps for R_*_NONE dynrelocs but not R_*_RELATIVE
> > > which i is just as bad for undef weak syms in pie)
> > > i added a note to the bug.
> > > 
> > > if you add __attribute__((visibility("hidden")))
> > > to the example given by Rich then it works, the
> > > bug only affects static pie linking.
> > 
> > That's really weird. How does it end up having an outstanding
> > *relative* relocation when it's not defined locally? I could
> > understand having a bogus outstanding symbolic one, but relative makes
> > no sense and suggests ld is doing something very wrong...
> 
> i'd guess it creates a relative reloc for every
> got entry that stores some symbol's address
> which is known to be local, which makes sense,
> except for undefined weak symbols which should
> have fixed 0 address.
> 
> and i'd guess there is some logic that special
> cases local undef weak in pic so hidden works,
> and that check should be extended to cover the
> static pie case.

In 2.33.1, the offending code (creating the bad relative relocation)
is at line 11637. It's possible some earlier code path leading to it
is wrong, around line 11515 or so, but I think there just needs to be
an extra else path before this one that covers undefined/undefweak.

Rich


  reply	other threads:[~2019-10-21 19:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21  4:43 Patrick Oppenlander
2019-10-21  5:04 ` Rich Felker
2019-10-21  5:20   ` Rich Felker
2019-10-21  5:34     ` Patrick Oppenlander
2019-10-21  5:38       ` Rich Felker
2019-10-21  5:51         ` Patrick Oppenlander
2019-10-21 18:09 ` Szabolcs Nagy
2019-10-21 19:03   ` Rich Felker
2019-10-21 19:08     ` Szabolcs Nagy
2019-10-21 19:29       ` Rich Felker [this message]
2020-01-10 10:22         ` Szabolcs Nagy
2020-01-11  6:20           ` Patrick Oppenlander
2019-10-21 21:17   ` Patrick Oppenlander

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=20191021192937.GJ16318@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).