mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: weimingz@codeaurora.org
Cc: musl@lists.openwall.com, Rich Felker <dalias@aerifal.cx>,
	Rich Felker <dalias@libc.org>
Subject: Re: build musl for armv7m
Date: Thu, 23 Jun 2016 11:57:47 +0200	[thread overview]
Message-ID: <20160623095747.GX22574@port70.net> (raw)
In-Reply-To: <5f0cfaa0d29db9e502d82e0c2a64001a@codeaurora.org>

* weimingz@codeaurora.org <weimingz@codeaurora.org> [2016-06-22 23:04:18 -0700]:
> If it is not a weak symbol, you may get "multi-def" error. It depends on the
> obj/lib order on command line.

the only external symbol definition with non-weak binding
in the exit.o object is exit.

so the only way exit.o can get linked is an undefined reference
to exit.

you only need to make sure that -lc is at the end of the cmdline
when you want to interpose exit with your own definition
(then libc exit.o wont get linked in).

but to repeat rich: interposing libc symbols can break things.

> If it is a weak symbol, then a non-weak symbol can override it.
> 
> Anyway, your comment reminds me that we can use -wrap=exit to override it.
> So no change is needed.
> 
> btw, will you commit the change of those .s files for armv7m ?
> 
> Thanks,
> Weiming
> 
> On 2016-06-22 21:22, Rich Felker wrote:
> >On Wed, Jun 22, 2016 at 05:21:54PM -0700, Zhao, Weiming wrote:
> >>Fixed.
> >>
> >>Btw, can we make exit() weak function? (patch attached)
> >>
> >>This allows user code to redefine it because in baremetal
> >>environment, sometime we want to customize it. For example, some
> >>code never exits, so we can define a dummy exit() and thus save code
> >>size.
> >
> >No, this is a hack and is not even needed to do what you're asking
> >for. The way linking an archive works, an object in the archive is
> >only pulled in to the link process when it satisfies an undefined
> >symbol reference, and if you defined your own exit, then exit.o would
> >never have reason to get linked.
> >
> >But there are all sorts of things that can break unexpectedly from
> >redefining standard functions, which is why it's UB and this is not
> >supported usage.
> >
> >Rich


  reply	other threads:[~2016-06-23  9:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14  8:49 weimingz
2016-06-14 13:00 ` Rich Felker
2016-06-14 16:12   ` Zhao, Weiming
2016-06-14 16:32     ` Szabolcs Nagy
2016-06-14 16:58       ` Zhao, Weiming
2016-06-14 17:40         ` Zhao, Weiming
2016-06-16 18:34           ` Zhao, Weiming
2016-06-20 19:58             ` Rich Felker
2016-06-22 19:08               ` Zhao, Weiming
2016-06-22 19:19                 ` Rich Felker
2016-06-22 20:37                   ` Zhao, Weiming
2016-06-22 23:26                     ` Rich Felker
2016-06-23  0:21                       ` Zhao, Weiming
2016-06-23  4:22                         ` Rich Felker
2016-06-23  6:04                           ` weimingz
2016-06-23  9:57                             ` Szabolcs Nagy [this message]
2016-06-23 14:22                               ` weimingz
2016-07-05 20:08                         ` Rich Felker
2016-06-20 17:17           ` Zhao, Weiming
2016-06-14 14:38 ` Rich Felker
2016-06-14 16:35   ` Zhao, Weiming

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=20160623095747.GX22574@port70.net \
    --to=nsz@port70.net \
    --cc=dalias@aerifal.cx \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=weimingz@codeaurora.org \
    /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).