From: Tobias Heider Subject: Re: qbe: include dbgloc patch for hare To: "Lorenz (xha)" Cc: bcallah@openbsd.org, ports@openbsd.org Date: Wed, 7 Feb 2024 11:35:53 +0100 On Wed, Feb 07, 2024 at 10:54:56AM +0100, Lorenz (xha) wrote: > fyi there might be a QBE release 1.2 before hare 0.24.0 > > https://lists.sr.ht/~sircmpwn/hare-dev/%3CCYYOPRMPIF11.2F5WIW9HORKTQ%40taiga%3E Thx for the info! I have a first working draft of a hare-0.24.0-rc2 port, I guess I will wait for it to be released before sending the update to the list. New qbe should make things easier. > > On Mon, Feb 05, 2024 at 08:54:54PM +0100, Tobias Heider wrote: > > For the next hare port update we will need this additional > > qbe patch, otherwise it won't build. > > > > This is upstream commit 85287081c4a25785dec1ec48c488a5879b3c37ac > > Unfortunately they haven't tagged a new version including that. > > > > ok to ship it as a patch? > > > > diff /home/user/got/co/ports > > commit - b8046539b93a72d6288d3d3643f7d6c95435a297 > > path + /home/user/got/co/ports > > blob - 502cd243b7828146f82d943d353e12028979ce03 > > file + lang/qbe/Makefile > > --- lang/qbe/Makefile > > +++ lang/qbe/Makefile > > @@ -4,6 +4,7 @@ ONLY_FOR_ARCHS = amd64 arm64 riscv64 > > COMMENT = small, quick compiler backend > > DISTNAME = qbe-1.1pl20230925 > > CATEGORIES = lang devel > > +REVISION = 0 > > > > HOMEPAGE = https://c9x.me/compile/ > > MAINTAINER = Brian Callahan > > blob - /dev/null > > file + lang/qbe/patches/patch-all_h (mode 644) > > --- /dev/null > > +++ lang/qbe/patches/patch-all_h > > @@ -0,0 +1,16 @@ > > +dbgloc: add column argument > > + > > +backport of 85287081c4a25785dec1ec48c488a5879b3c37ac > > + > > +Index: all.h > > +--- all.h.orig > > ++++ all.h > > +@@ -569,7 +569,7 @@ void rega(Fn *); > > + void emitfnlnk(char *, Lnk *, FILE *); > > + void emitdat(Dat *, FILE *); > > + void emitdbgfile(char *, FILE *); > > +-void emitdbgloc(uint, FILE *); > > ++void emitdbgloc(uint, uint, FILE *); > > + int stashbits(void *, int); > > + void elf_emitfnfin(char *, FILE *); > > + void elf_emitfin(FILE *); > > blob - /dev/null > > file + lang/qbe/patches/patch-amd64_emit_c (mode 644) > > --- /dev/null > > +++ lang/qbe/patches/patch-amd64_emit_c > > @@ -0,0 +1,16 @@ > > +dbgloc: add column argument > > + > > +backport of 85287081c4a25785dec1ec48c488a5879b3c37ac > > + > > +Index: amd64/emit.c > > +--- amd64/emit.c.orig > > ++++ amd64/emit.c > > +@@ -548,7 +548,7 @@ emitins(Ins i, Fn *fn, FILE *f) > > + emitcopy(i.arg[1], TMP(XMM0+15), i.cls, fn, f); > > + break; > > + case Odbgloc: > > +- emitdbgloc(i.arg[0].val, f); > > ++ emitdbgloc(i.arg[0].val, i.arg[1].val, f); > > + break; > > + } > > + } > > blob - /dev/null > > file + lang/qbe/patches/patch-arm64_emit_c (mode 644) > > --- /dev/null > > +++ lang/qbe/patches/patch-arm64_emit_c > > @@ -0,0 +1,16 @@ > > +dbgloc: add column argument > > + > > +backport of 85287081c4a25785dec1ec48c488a5879b3c37ac > > + > > +Index: arm64/emit.c > > +--- arm64/emit.c.orig > > ++++ arm64/emit.c > > +@@ -447,7 +447,7 @@ emitins(Ins *i, E *e) > > + emitf("mov %=, sp", i, e); > > + break; > > + case Odbgloc: > > +- emitdbgloc(i->arg[0].val, e->f); > > ++ emitdbgloc(i->arg[0].val, i->arg[1].val, e->f); > > + break; > > + } > > + } > > blob - /dev/null > > file + lang/qbe/patches/patch-emit_c (mode 644) > > --- /dev/null > > +++ lang/qbe/patches/patch-emit_c > > @@ -0,0 +1,20 @@ > > +dbgloc: add column argument > > + > > +backport of 85287081c4a25785dec1ec48c488a5879b3c37ac > > + > > +Index: emit.c > > +--- emit.c.orig > > ++++ emit.c > > +@@ -235,7 +235,10 @@ emitdbgfile(char *fn, FILE *f) > > + } > > + > > + void > > +-emitdbgloc(uint loc, FILE *f) > > ++emitdbgloc(uint line, uint col, FILE *f) > > + { > > +- fprintf(f, "\t.loc %u %u\n", curfile, loc); > > ++ if (col != 0) > > ++ fprintf(f, "\t.loc %u %u %u\n", curfile, line, col); > > ++ else > > ++ fprintf(f, "\t.loc %u %u\n", curfile, line); > > + } > > blob - /dev/null > > file + lang/qbe/patches/patch-ops_h (mode 644) > > --- /dev/null > > +++ lang/qbe/patches/patch-ops_h > > @@ -0,0 +1,16 @@ > > +dbgloc: add column argument > > + > > +backport of 85287081c4a25785dec1ec48c488a5879b3c37ac > > + > > +Index: ops.h > > +--- ops.h.orig > > ++++ ops.h > > +@@ -122,7 +122,7 @@ O(vastart, T(m,e,e,e, x,e,e,e), 0) X(0, 0, 0) V(0) > > + O(copy, T(w,l,s,d, x,x,x,x), 0) X(0, 0, 1) V(0) > > + > > + /* Debug */ > > +-O(dbgloc, T(w,l,s,d, x,x,x,x), 0) X(0, 0, 1) V(0) > > ++O(dbgloc, T(w,e,e,e, w,e,e,e), 0) X(0, 0, 1) V(0) > > + > > + /****************************************/ > > + /* INTERNAL OPERATIONS (keep nop first) */ > > blob - /dev/null > > file + lang/qbe/patches/patch-parse_c (mode 644) > > --- /dev/null > > +++ lang/qbe/patches/patch-parse_c > > @@ -0,0 +1,22 @@ > > +dbgloc: add column argument > > + > > +backport of 85287081c4a25785dec1ec48c488a5879b3c37ac > > + > > +Index: parse.c > > +--- parse.c.orig > > ++++ parse.c > > +@@ -669,6 +669,14 @@ parseline(PState ps) > > + arg[0] = INT(tokval.num); > > + if (arg[0].val != tokval.num) > > + err("line number too big"); > > ++ if (peek() == Tcomma) { > > ++ next(); > > ++ expect(Tint); > > ++ arg[1] = INT(tokval.num); > > ++ if (arg[1].val != tokval.num) > > ++ err("column number too big"); > > ++ } else > > ++ arg[1] = INT(0); > > + goto Ins; > > + } > > + if (op == Tcall) { > > blob - /dev/null > > file + lang/qbe/patches/patch-rv64_emit_c (mode 644) > > --- /dev/null > > +++ lang/qbe/patches/patch-rv64_emit_c > > @@ -0,0 +1,16 @@ > > +dbgloc: add column argument > > + > > +backport of 85287081c4a25785dec1ec48c488a5879b3c37ac > > + > > +Index: rv64/emit.c > > +--- rv64/emit.c.orig > > ++++ rv64/emit.c > > +@@ -406,7 +406,7 @@ emitins(Ins *i, Fn *fn, FILE *f) > > + emitf("mv %=, sp", i, fn, f); > > + break; > > + case Odbgloc: > > +- emitdbgloc(i->arg[0].val, f); > > ++ emitdbgloc(i->arg[0].val, i->arg[1].val, f); > > + break; > > + } > > + } > > >