shithub: riscv

Download patch

ref: b599dc0e5486923085f238e146d5a1750bc168a9
parent: f860f25f054305a6430d2113bb5e6c4680b1a2f3
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun May 17 15:08:10 EDT 2020

7l: handle dupok flag in TEXT/GLOBL data

--- a/sys/src/cmd/7l/asm.c
+++ b/sys/src/cmd/7l/asm.c
@@ -493,7 +493,7 @@
 		}
 		if(l >= n)
 			continue;
-		if(p->as != AINIT && p->as != ADYNT) {
+		if(p->as != AINIT && p->as != ADYNT && !p->from.sym->dupok) {
 			for(j=l+(c-i)-1; j>=l; j--)
 				if(buf.dbuf[j]) {
 					print("%P\n", p);
--- a/sys/src/cmd/7l/l.h
+++ b/sys/src/cmd/7l/l.h
@@ -81,6 +81,7 @@
 	short	version;
 	short	become;
 	short	frame;
+	char	dupok;
 	uchar	subtype;
 	ushort	file;
 	vlong	value;
--- a/sys/src/cmd/7l/obj.c
+++ b/sys/src/cmd/7l/obj.c
@@ -839,6 +839,8 @@
 			diag("GLOBL must have a name\n%P", p);
 			errorexit();
 		}
+		if(p->reg & DUPOK)
+			s->dupok = 1;
 		if(s->type == 0 || s->type == SXREF) {
 			s->type = SBSS;
 			s->value = 0;
@@ -1122,7 +1124,7 @@
 	s->version = v;
 	s->value = 0;
 	s->sig = 0;
-//	s->dupok = 0;
+	s->dupok = 0;
 	hash[h] = s;
 	return s;
 }