From: Ori Bernstein <ori@eigenstate.org>
To: 9front@9front.org
Cc: cinap_lenrek@felloff.net
Subject: Re: [9front] Patch: Respect DUPOK flag on GLOBL (for 6l).
Date: Sat, 18 Mar 2017 18:33:26 -0700 [thread overview]
Message-ID: <20170318183326.ea6dbb6748e8bf1495982dbf@eigenstate.org> (raw)
In-Reply-To: <c565e1d31bfcc8d800b3a5e7b9a638fe@felloff.net>
[-- Attachment #1: Type: text/plain, Size: 707 bytes --]
On Sat, 18 Mar 2017 20:36:56 +0100, cinap_lenrek@felloff.net wrote:
> you can test for arm as well using aijus 5e(1).
>
> --
> cinap
Done.
I ignored 1l and 2l, since neither have support for DUPOK symbols, even
for text, but I built and minimally tested all other architectures. For
amd64, I've rebuilt the os and run it. For 386 and arm, I've built some
simple test programs with duplicated DATA initializations and run them.
For mips and sparc, I rebuilt everything with my patches, and then built
binaries with duplicated DATA sections. These binaries were not run, since
I don't have a sparc or mips system.
I also grabbed a check for a null symbol in GLOBL
Patch attached.
--
Ori Bernstein
[-- Attachment #2: linkers.patch --]
[-- Type: text/x-diff, Size: 7692 bytes --]
diff -r a6a7ca49c2e7 sys/src/cmd/5l/asm.c
--- a/sys/src/cmd/5l/asm.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/5l/asm.c Sat Mar 18 18:30:55 2017 -0700
@@ -578,7 +578,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);
diff -r a6a7ca49c2e7 sys/src/cmd/5l/l.h
--- a/sys/src/cmd/5l/l.h Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/5l/l.h Sat Mar 18 18:30:55 2017 -0700
@@ -82,6 +82,7 @@
short become;
short frame;
uchar subtype;
+ char dupok;
ushort file;
long value;
long sig;
diff -r a6a7ca49c2e7 sys/src/cmd/5l/obj.c
--- a/sys/src/cmd/5l/obj.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/5l/obj.c Sat Mar 18 18:30:55 2017 -0700
@@ -868,6 +868,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;
@@ -1113,6 +1115,7 @@
s->version = v;
s->value = 0;
s->sig = 0;
+ s->dupok = 0;
hash[h] = s;
return s;
}
diff -r a6a7ca49c2e7 sys/src/cmd/6l/asm.c
--- a/sys/src/cmd/6l/asm.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/6l/asm.c Sat Mar 18 18:30:55 2017 -0700
@@ -316,7 +316,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);
diff -r a6a7ca49c2e7 sys/src/cmd/6l/l.h
--- a/sys/src/cmd/6l/l.h Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/6l/l.h Sat Mar 18 18:30:55 2017 -0700
@@ -79,6 +79,7 @@
short version;
short become;
short frame;
+ char dupok;
uchar subtype;
ushort file;
vlong value;
diff -r a6a7ca49c2e7 sys/src/cmd/6l/list.c
--- a/sys/src/cmd/6l/list.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/6l/list.c Sat Mar 18 18:30:55 2017 -0700
@@ -23,6 +23,7 @@
bigP = p;
switch(p->as) {
case ATEXT:
+ case AGLOBL:
if(p->from.scale) {
snprint(str, sizeof str, "(%ld) %A %D,%d,%D",
p->line, p->as, &p->from, p->from.scale, &p->to);
diff -r a6a7ca49c2e7 sys/src/cmd/6l/obj.c
--- a/sys/src/cmd/6l/obj.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/6l/obj.c Sat Mar 18 18:30:55 2017 -0700
@@ -899,10 +899,13 @@
case AGLOBL:
s = p->from.sym;
+ if(p->from.scale & DUPOK)
+ s->dupok = 1;
if(s->type == 0 || s->type == SXREF) {
s->type = SBSS;
s->value = 0;
}
+
if(s->type != SBSS) {
diag("%s: redefinition: %s in %s",
pn, s->name, TNAME);
@@ -1158,6 +1161,7 @@
s->version = v;
s->value = 0;
s->sig = 0;
+ s->dupok = 0;
hash[h] = s;
nsymbol++;
return s;
diff -r a6a7ca49c2e7 sys/src/cmd/8l/asm.c
--- a/sys/src/cmd/8l/asm.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/8l/asm.c Sat Mar 18 18:30:55 2017 -0700
@@ -421,7 +421,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);
diff -r a6a7ca49c2e7 sys/src/cmd/8l/l.h
--- a/sys/src/cmd/8l/l.h Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/8l/l.h Sat Mar 18 18:30:55 2017 -0700
@@ -80,6 +80,7 @@
short become;
short frame;
uchar subtype;
+ char dupok;
ushort file;
long value;
long sig;
diff -r a6a7ca49c2e7 sys/src/cmd/8l/list.c
--- a/sys/src/cmd/8l/list.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/8l/list.c Sat Mar 18 18:30:55 2017 -0700
@@ -23,6 +23,7 @@
bigP = p;
switch(p->as) {
case ATEXT:
+ case AGLOBL:
if(p->from.scale) {
snprint(str, sizeof(str), "(%ld) %A %D,%d,%D",
p->line, p->as, &p->from, p->from.scale, &p->to);
diff -r a6a7ca49c2e7 sys/src/cmd/8l/obj.c
--- a/sys/src/cmd/8l/obj.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/8l/obj.c Sat Mar 18 18:30:55 2017 -0700
@@ -885,6 +885,8 @@
case AGLOBL:
s = p->from.sym;
+ if(p->from.scale & DUPOK)
+ s->dupok = 1;
if(s->type == 0 || s->type == SXREF) {
s->type = SBSS;
s->value = 0;
@@ -1134,6 +1136,7 @@
s->version = v;
s->value = 0;
s->sig = 0;
+ s->dupok = 0;
hash[h] = s;
nsymbol++;
return s;
diff -r a6a7ca49c2e7 sys/src/cmd/kl/asm.c
--- a/sys/src/cmd/kl/asm.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/kl/asm.c Sat Mar 18 18:30:55 2017 -0700
@@ -396,7 +396,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);
diff -r a6a7ca49c2e7 sys/src/cmd/kl/l.h
--- a/sys/src/cmd/kl/l.h Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/kl/l.h Sat Mar 18 18:30:55 2017 -0700
@@ -65,6 +65,7 @@
short version;
short become;
short frame;
+ char dupok;
long value;
Sym *link;
};
diff -r a6a7ca49c2e7 sys/src/cmd/kl/obj.c
--- a/sys/src/cmd/kl/obj.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/kl/obj.c Sat Mar 18 18:30:55 2017 -0700
@@ -737,6 +737,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;
@@ -951,6 +953,7 @@
s->type = 0;
s->version = v;
s->value = 0;
+ s->dupok = 0;
hash[h] = s;
return s;
}
diff -r a6a7ca49c2e7 sys/src/cmd/ql/asm.c
--- a/sys/src/cmd/ql/asm.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/ql/asm.c Sat Mar 18 18:30:55 2017 -0700
@@ -756,7 +756,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);
diff -r a6a7ca49c2e7 sys/src/cmd/ql/l.h
--- a/sys/src/cmd/ql/l.h Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/ql/l.h Sat Mar 18 18:30:55 2017 -0700
@@ -61,6 +61,7 @@
short become;
short frame;
uchar subtype;
+ char dupok;
ushort file;
long value;
long sig;
diff -r a6a7ca49c2e7 sys/src/cmd/ql/obj.c
--- a/sys/src/cmd/ql/obj.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/ql/obj.c Sat Mar 18 18:30:55 2017 -0700
@@ -849,6 +849,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;
@@ -1085,6 +1087,7 @@
s->version = v;
s->value = 0;
s->sig = 0;
+ s->dupok = 0;
hash[h] = s;
return s;
}
diff -r a6a7ca49c2e7 sys/src/cmd/vl/asm.c
--- a/sys/src/cmd/vl/asm.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/vl/asm.c Sat Mar 18 18:30:55 2017 -0700
@@ -708,7 +708,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);
diff -r a6a7ca49c2e7 sys/src/cmd/vl/l.h
--- a/sys/src/cmd/vl/l.h Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/vl/l.h Sat Mar 18 18:30:55 2017 -0700
@@ -74,6 +74,7 @@
short version;
short become;
short frame;
+ char dupok;
long value;
Sym* link;
};
diff -r a6a7ca49c2e7 sys/src/cmd/vl/obj.c
--- a/sys/src/cmd/vl/obj.c Tue Mar 14 23:46:35 2017 +0100
+++ b/sys/src/cmd/vl/obj.c Sat Mar 18 18:30:55 2017 -0700
@@ -803,6 +803,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;
@@ -1036,6 +1038,7 @@
s->type = 0;
s->version = v;
s->value = 0;
+ s->dupok = 0;
hash[h] = s;
return s;
}
next prev parent reply other threads:[~2017-03-19 1:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-18 19:36 cinap_lenrek
2017-03-19 1:33 ` Ori Bernstein [this message]
2017-03-19 1:55 cinap_lenrek
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=20170318183326.ea6dbb6748e8bf1495982dbf@eigenstate.org \
--to=ori@eigenstate.org \
--cc=9front@9front.org \
--cc=cinap_lenrek@felloff.net \
/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.
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).