From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8601 Path: news.gmane.org!not-for-mail From: Alex Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH 3/3] Add script to add CFI directives to asm files in debug builds of x86_64 Date: Fri, 2 Oct 2015 13:01:40 +0200 Message-ID: References: <1443780123-6493-1-git-send-email-alexinbeijing@gmail.com> <1443780123-6493-3-git-send-email-alexinbeijing@gmail.com> <20151002101921.GS8645@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113ed8189c0c5805211d168c X-Trace: ger.gmane.org 1443783728 32545 80.91.229.3 (2 Oct 2015 11:02:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 2 Oct 2015 11:02:08 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8613-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 02 13:01:56 2015 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 1Zhy66-0005Zx-G0 for gllmg-musl@m.gmane.org; Fri, 02 Oct 2015 13:01:54 +0200 Original-Received: (qmail 18149 invoked by uid 550); 2 Oct 2015 11:01:53 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 18126 invoked from network); 2 Oct 2015 11:01:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=bUTliFp1vK85iqUuU+ES/UhZrH0lNAGPV0h1YmCFE0E=; b=ZjJY4Ne0ADsNanKvmgBRshi+fP2lpFD6uXNGLBTH1hFpwIdAwCgsR7y4LtJj9DIDUN iDXN4AuZpe4gkZQZHq8cOXpfaaD1R8rKWAUbgrzmSVBokj4FYmeD5ozFiqouIahJyDA3 sd6NgzcnAo2rrLtM6lhirEgOVfhHBBwJLjtqudRtcbjJLUielPP5dY2yB+SsxsPupUW4 aB0y9n/zXP7r3E03EwHuMI3cNaePHwSqpB64AxfQc3Uf2qsTHAYRbaNwtOb6yFqY57fZ EVrqGX6CKiB0c2j5SGmq8CkL+53AnNXHYsupwOsdTZpaaKD2ZpJS7MI+VGB5+jxl5yg2 /Rxg== X-Received: by 10.107.11.166 with SMTP id 38mr15960296iol.186.1443783700645; Fri, 02 Oct 2015 04:01:40 -0700 (PDT) In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:8601 Archived-At: --001a113ed8189c0c5805211d168c Content-Type: text/plain; charset=UTF-8 On Fri, Oct 2, 2015 at 12:58 PM, Alex wrote: > > On Fri, Oct 2, 2015 at 12:19 PM, Rich Felker wrote: > >> On Fri, Oct 02, 2015 at 12:02:03PM +0200, Alex Dowad wrote: >> > +# this does NOT exhaustively check for all possible instructions which >> could >> > +# overwrite a register value inherited from the caller (just the >> common ones) >> > +/mov.*,%r(ax|bx|cx|dx|si|di|bp|8|9|10|11|12|13|14|15)/ { >> trashed(get_reg2()) } >> > +/(add|addl|sub|subl|and|or|xor|lea|sal|sar|shl|shr) >> %r(ax|bx|cx|dx|si|di|bp|8|9|10|11|12|13|14|15),/ { >> > + trashed(get_reg1()) >> > +} >> >> This looks wrong but maybe it's already wrong in existing code. Why >> are you marking the first operand as trashed rather than the second? > > > You're absolutely right! > I'm pretty sure the reason I made this mistake was because of reading Intel's developer manuals, where they write the destination register as the first operand, and then absentmindedly applying the GNU syntax used by musl. --001a113ed8189c0c5805211d168c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On F= ri, Oct 2, 2015 at 12:58 PM, Alex <alexinbeijing@gmail.com> wrote:
On Fri, Oct 2, 2015= at 12:19 PM, Rich Felker <dalias@libc.org> wrote:
On Fri, Oct 02, 2015 at 12:02:03PM +0200, Alex= Dowad wrote:
> +# this does NOT exhaustively check for all possible instructions whic= h could
> +# overwrite a register value inherited from the caller (just the comm= on ones)
> +/mov.*,%r(ax|bx|cx|dx|si|di|bp|8|9|10|11|12|13|14|15)/=C2=A0 { trashe= d(get_reg2()) }
> +/(add|addl|sub|subl|and|or|xor|lea|sal|sar|shl|shr) %r(ax|bx|cx|dx|si= |di|bp|8|9|10|11|12|13|14|15),/ {
> +=C2=A0 trashed(get_reg1())
> +}

This looks wrong but maybe it's already wrong in existing code. = Why
are you marking the first operand as trashed rather than the second?

You're absolutely right!=C2=A0

I'm pretty sure= the reason I made this mistake was because of reading Intel's develope= r manuals, where they write the destination register as the first operand, = and then absentmindedly applying the GNU syntax used by musl.
--001a113ed8189c0c5805211d168c--