* Re: [9front] Patch: Respect DUPOK flag on GLOBL (for 6l).
@ 2017-03-18 19:36 cinap_lenrek
2017-03-19 1:33 ` Ori Bernstein
0 siblings, 1 reply; 3+ messages in thread
From: cinap_lenrek @ 2017-03-18 19:36 UTC (permalink / raw)
To: 9front
you can test for arm as well using aijus 5e(1).
--
cinap
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9front] Patch: Respect DUPOK flag on GLOBL (for 6l).
2017-03-18 19:36 [9front] Patch: Respect DUPOK flag on GLOBL (for 6l) cinap_lenrek
@ 2017-03-19 1:33 ` Ori Bernstein
0 siblings, 0 replies; 3+ messages in thread
From: Ori Bernstein @ 2017-03-19 1:33 UTC (permalink / raw)
To: 9front; +Cc: cinap_lenrek
[-- 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;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9front] Patch: Respect DUPOK flag on GLOBL (for 6l).
@ 2017-03-19 1:55 cinap_lenrek
0 siblings, 0 replies; 3+ messages in thread
From: cinap_lenrek @ 2017-03-19 1:55 UTC (permalink / raw)
To: 9front
looks good. will apply.
--
cinap
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-19 1:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-18 19:36 [9front] Patch: Respect DUPOK flag on GLOBL (for 6l) cinap_lenrek
2017-03-19 1:33 ` Ori Bernstein
2017-03-19 1:55 cinap_lenrek
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).