From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10211 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: build musl for armv7m Date: Thu, 23 Jun 2016 11:57:47 +0200 Message-ID: <20160623095747.GX22574@port70.net> References: <0e13c593-33fa-be67-5e73-cec7d7edfe15@codeaurora.org> <20160620195832.GN10893@brightrain.aerifal.cx> <20160622191940.GS10893@brightrain.aerifal.cx> <34aab271-7305-3376-f5ad-7ae161c93428@codeaurora.org> <20160622232640.GV10893@brightrain.aerifal.cx> <20160623042244.GW10893@brightrain.aerifal.cx> <5f0cfaa0d29db9e502d82e0c2a64001a@codeaurora.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1466675909 3374 80.91.229.3 (23 Jun 2016 09:58:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Jun 2016 09:58:29 +0000 (UTC) Cc: musl@lists.openwall.com, Rich Felker , Rich Felker To: weimingz@codeaurora.org Original-X-From: musl-return-10224-gllmg-musl=m.gmane.org@lists.openwall.com Thu Jun 23 11:58:13 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1bG1Od-0002l9-Eh for gllmg-musl@m.gmane.org; Thu, 23 Jun 2016 11:58:03 +0200 Original-Received: (qmail 29789 invoked by uid 550); 23 Jun 2016 09:57:59 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 29768 invoked from network); 23 Jun 2016 09:57:59 -0000 Mail-Followup-To: weimingz@codeaurora.org, musl@lists.openwall.com, Rich Felker , Rich Felker Content-Disposition: inline In-Reply-To: <5f0cfaa0d29db9e502d82e0c2a64001a@codeaurora.org> User-Agent: Mutt/1.5.24 (2015-08-30) Xref: news.gmane.org gmane.linux.lib.musl.general:10211 Archived-At: * 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