ref: f280df62936ff48565f8c83bf609726a6af9a690
parent: 81c19d1a4fb393758ce2f08c63f8511ada5bc413
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Mar 5 11:34:19 EST 2016
Add comdat support. Start of work for deduping symbols.
--- a/6/asm.h
+++ b/6/asm.h
@@ -74,6 +74,7 @@
size_t align;
char *lbl; /* may be null */
char isglobl;
+ char iscomdat;
union {
uint64_t npad;
uint64_t ival;
--- a/6/gengas.c
+++ b/6/gengas.c
@@ -304,6 +304,8 @@
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 @@
ty->isemitted = 1;
b = tydescblob(ty);
+ b->iscomdat = 1;
writeblob(fd, b);
blobfree(b);
}