Browse Source

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

pull/14/head
PoroCYon 2 years ago
committed by PoroCYon
parent
commit
788135c670
2 changed files with 13 additions and 1 deletions
  1. +7
    -1
      Makefile
  2. +6
    -0
      src/smolparse.py

+ 7
- 1
Makefile View File

@ -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) "$<" "$@"


+ 6
- 0
src/smolparse.py View File

@ -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]]))


Loading…
Cancel
Save