GLLVM doesn't currently distinguish between multiple compilations of the same input file in a single build. For example, imagine the following:
all: foo.exe foo.patched.exe
%.exe: $(SRC_DIR)/%.c
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -o $@ $^
%.patched.exe: $(SRC_DIR)/%.c
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -DPATCHED=1 -o $@ $^
When make all is run, foo.c is compiled twice: once with -DPATCHED=1 and once without.
GLLVM however only produces only one .foo.c.{o,bc} tuple, meaning that the get-bc-collected bitcode for both foo.exe and foo.patched.exe is the same (whichever target make ran last).
I think the solution here is to rewrite GLLVM's object and bitcode file emission to use content-addressed filenames, rather than path-computed filenames.
GLLVM doesn't currently distinguish between multiple compilations of the same input file in a single build. For example, imagine the following:
When
make allis run,foo.cis compiled twice: once with-DPATCHED=1and once without.GLLVM however only produces only one
.foo.c.{o,bc}tuple, meaning that theget-bc-collected bitcode for bothfoo.exeandfoo.patched.exeis the same (whichever targetmakeran last).I think the solution here is to rewrite GLLVM's object and bitcode file emission to use content-addressed filenames, rather than path-computed filenames.