summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-03-05 16:34:19 -0800
committerOri Bernstein <ori@eigenstate.org>2016-03-05 16:36:31 -0800
commitf280df62936ff48565f8c83bf609726a6af9a690 (patch)
tree8d914e93f53d58cd2765a3e9f186d686f6d68489 /6
parent81c19d1a4fb393758ce2f08c63f8511ada5bc413 (diff)
downloadmc-f280df62936ff48565f8c83bf609726a6af9a690.tar.gz
Add comdat support.
Start of work for deduping symbols.
Diffstat (limited to '6')
-rw-r--r--6/asm.h1
-rw-r--r--6/gengas.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/6/asm.h b/6/asm.h
index 82b1b6d..ed75659 100644
--- a/6/asm.h
+++ b/6/asm.h
@@ -74,6 +74,7 @@ struct Blob {
size_t align;
char *lbl; /* may be null */
char isglobl;
+ char iscomdat;
union {
uint64_t npad;
uint64_t ival;
diff --git a/6/gengas.c b/6/gengas.c
index 5307661..5f15c38 100644
--- a/6/gengas.c
+++ b/6/gengas.c
@@ -304,6 +304,8 @@ static void writeblob(FILE *fd, Blob *b)
if (!b)
return;
if (b->lbl) {
+ if (b->iscomdat)
+ fprintf(fd, ".section .text.%s%s,\"axG\",%s%s,comdat\n", Symprefix, b->lbl, Symprefix, b->lbl);
if (b->isglobl)
fprintf(fd, ".globl %s%s\n", Symprefix, b->lbl);
fprintf(fd, "%s%s:\n", Symprefix, b->lbl);
@@ -356,6 +358,7 @@ static void gentype(FILE *fd, Type *ty)
ty->isemitted = 1;
b = tydescblob(ty);
+ b->iscomdat = 1;
writeblob(fd, b);
blobfree(b);
}