Port linkerscript parser to Bison (#1266)

Notable side effects:
* Use the standard-conformant MSVC preproc
* Add test for linker script INCLUDE
* Improve wording of placement conflict errors
* Fix errors from not newline-terminated files
* Teach checkdiff about the linker script doc
* Call linker script "commands" "directives" instead

---------

Co-authored-by: Rangi42 <remy.oukaour+rangi42@gmail.com>
This commit is contained in:
Eldred Habert
2023-12-11 02:29:37 +01:00
committed by GitHub
parent ab30690854
commit fd78a9ae83
28 changed files with 573 additions and 656 deletions

View File

@@ -65,14 +65,14 @@ rgbasm_obj := \
src/asm/rpn.o \
src/asm/section.o \
src/asm/symbol.o \
src/asm/util.o \
src/asm/warning.o \
src/extern/getopt.o \
src/extern/utf8decoder.o \
src/error.o \
src/hashmap.o \
src/linkdefs.o \
src/opmath.o
src/opmath.o \
src/util.o
src/asm/lexer.o src/asm/main.o: src/asm/parser.hpp
@@ -91,7 +91,8 @@ rgblink_obj := \
src/error.o \
src/hashmap.o \
src/linkdefs.o \
src/opmath.o
src/opmath.o \
src/util.o
rgbfix_obj := \
src/fix/main.o \
@@ -133,13 +134,13 @@ test/gfx/rgbgfx_test: test/gfx/rgbgfx_test.cpp
# We want the Bison invocation to pass through our rules, not default ones
.y.o:
.y.cpp:
$Q${BISON} $@ $<
# Bison-generated C++ files have an accompanying header
src/asm/parser.hpp: src/asm/parser.cpp
$Qtouch $@
src/asm/parser.cpp: src/asm/parser.y
$Q${BISON} $@ $<
# Only RGBGFX uses libpng (POSIX make doesn't support pattern rules to cover all these)
src/gfx/main.o: src/gfx/main.cpp
$Q${CXX} ${REALCXXFLAGS} ${PNGCFLAGS} -c -o $@ $<
@@ -172,6 +173,7 @@ clean:
$Qfind . -type f \( -name "*.gcno" -o -name "*.gcda" -o -name "*.gcov" \) -exec rm {} \;
$Q${RM} rgbshim.sh
$Q${RM} src/asm/parser.cpp src/asm/parser.hpp
$Q${RM} src/link/script.cpp src/link/script.hpp src/link/stack.hh
$Q${RM} test/gfx/randtilegen test/gfx/rgbgfx_test
# Target used to install the binaries and man pages.