Commit 788135c6 authored by PoroCYon's avatar PoroCYon Committed by PoroCYon
Browse files

add fix for gcc 9.1 in the makefile, don't accept LTO input files

parent 2f535bef
......@@ -58,6 +58,12 @@ clean:
%/:
@mkdir -vp "$@"
ifneq ($(findstring (GCC) 9,$(shell $(CC) --version)),)
INCLINKOPT := -flinker-output=nolto-rel
else
INCLINKOPT :=
endif
.SECONDARY:
$(OBJDIR)/%.lto.o: $(SRCDIR)/%.c $(OBJDIR)/
......@@ -71,7 +77,7 @@ $(OBJDIR)/%.o: $(TESTDIR)/%.c $(OBJDIR)/
$(CC) $(CFLAGS) -c "$<" -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
$(PYTHON3) $(PYDIR)/smol.py $(SMOLFLAGS) $(LIBS) "$<" "$@"
......
......@@ -56,10 +56,16 @@ def get_needed_syms(readelf_bin, inpfiles):
relocs = build_reloc_typ_table(outrel)
curfile = inpfiles[0]
syms=set({})
for entry in output.decode('utf-8').splitlines():
stuff = entry.split()
if len(stuff)<2: continue
if stuff[0] == "File:": curfile = stuff[1]
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 \
and stuff[7] in relocs:
syms.add((stuff[7], relocs[stuff[7]]))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment