mirror of https://github.com/Shizmob/smol
add fix for gcc 9.1 in the makefile, don't accept LTO input files
This commit is contained in:
parent
2f535befa2
commit
788135c670
8
Makefile
8
Makefile
|
@ -58,6 +58,12 @@ clean:
|
||||||
%/:
|
%/:
|
||||||
@mkdir -vp "$@"
|
@mkdir -vp "$@"
|
||||||
|
|
||||||
|
ifneq ($(findstring (GCC) 9,$(shell $(CC) --version)),)
|
||||||
|
INCLINKOPT := -flinker-output=nolto-rel
|
||||||
|
else
|
||||||
|
INCLINKOPT :=
|
||||||
|
endif
|
||||||
|
|
||||||
.SECONDARY:
|
.SECONDARY:
|
||||||
|
|
||||||
$(OBJDIR)/%.lto.o: $(SRCDIR)/%.c $(OBJDIR)/
|
$(OBJDIR)/%.lto.o: $(SRCDIR)/%.c $(OBJDIR)/
|
||||||
|
@ -71,7 +77,7 @@ $(OBJDIR)/%.o: $(TESTDIR)/%.c $(OBJDIR)/
|
||||||
$(CC) $(CFLAGS) -c "$<" -o "$@"
|
$(CC) $(CFLAGS) -c "$<" -o "$@"
|
||||||
|
|
||||||
$(OBJDIR)/%.start.o: $(OBJDIR)/%.lto.o $(OBJDIR)/crt1.lto.o
|
$(OBJDIR)/%.start.o: $(OBJDIR)/%.lto.o $(OBJDIR)/crt1.lto.o
|
||||||
$(CC) $(LDFLAGS) -r -o "$@" $^
|
$(CC) $(LDFLAGS) -r $(INCLINKOPT) -o "$@" $^
|
||||||
|
|
||||||
$(OBJDIR)/symbols.%.asm: $(OBJDIR)/%.o
|
$(OBJDIR)/symbols.%.asm: $(OBJDIR)/%.o
|
||||||
$(PYTHON3) $(PYDIR)/smol.py $(SMOLFLAGS) $(LIBS) "$<" "$@"
|
$(PYTHON3) $(PYDIR)/smol.py $(SMOLFLAGS) $(LIBS) "$<" "$@"
|
||||||
|
|
|
@ -56,10 +56,16 @@ def get_needed_syms(readelf_bin, inpfiles):
|
||||||
|
|
||||||
relocs = build_reloc_typ_table(outrel)
|
relocs = build_reloc_typ_table(outrel)
|
||||||
|
|
||||||
|
curfile = inpfiles[0]
|
||||||
syms=set({})
|
syms=set({})
|
||||||
for entry in output.decode('utf-8').splitlines():
|
for entry in output.decode('utf-8').splitlines():
|
||||||
stuff = entry.split()
|
stuff = entry.split()
|
||||||
|
if len(stuff)<2: continue
|
||||||
|
if stuff[0] == "File:": curfile = stuff[1]
|
||||||
if len(stuff)<8: continue
|
if len(stuff)<8: continue
|
||||||
|
if stuff[7].startswith("__gnu_lto_"): # yikes, an LTO object
|
||||||
|
eprintf("{} is an LTO object file, can't use this!".format(curfile))
|
||||||
|
exit(1)
|
||||||
if stuff[4] == "GLOBAL" and stuff[6] == "UND" and len(stuff[7])>0 \
|
if stuff[4] == "GLOBAL" and stuff[6] == "UND" and len(stuff[7])>0 \
|
||||||
and stuff[7] in relocs:
|
and stuff[7] in relocs:
|
||||||
syms.add((stuff[7], relocs[stuff[7]]))
|
syms.add((stuff[7], relocs[stuff[7]]))
|
||||||
|
|
Loading…
Reference in New Issue