Skip to content
This repository was archived by the owner on Nov 4, 2021. It is now read-only.

Bugfix/79 ghdl link #80

Merged
merged 3 commits into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ variables:
value: "1"
- name: CLEAN_AFTER_BUILD
value: "1"
- name: STRIP_SYMBOLS
value: "1"
- name: COMPILE_DFU_UTIL
value: "1"
- name: COMPILE_YOSYS
Expand Down
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ INSTALL_DEPS="${INSTALL_DEPS:-1}"
# (keeps disk space usage lower in CI runs)
CLEAN_AFTER_BUILD="${CLEAN_AFTER_BUILD:-1}"

STRIP_SYMBOLS="${STRIP_SYMBOLS:-1}"

# Enable each individual tool
COMPILE_DFU_UTIL="${COMPILE_DFU_UTIL:-1}"
COMPILE_YOSYS="${COMPILE_YOSYS:-1}"
Expand Down
62 changes: 62 additions & 0 deletions patches/ghdl/ghdl_largs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
diff --git a/Makefile.in b/Makefile.in
index ddae0c82..2ab769d0 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -200,7 +200,7 @@ GHDL_MCODE_INCFLAGS=$(GHDL_COMMON_INCFLAGS) -aI$(srcdir)/src/ghdldrv -aI$(srcdir
ghdl_mcode$(EXEEXT): GRT_FLAGS+=-DWITH_GNAT_RUN_TIME
ghdl_mcode$(EXEEXT): $(GRT_ADD_OBJS) $(GRT_SRC_DEPS) $(ORTHO_DEPS) \
memsegs_c.o chkstk.o version.ads force
- $(GNATMAKE) -o $@ -gnat12 $(GHDL_MCODE_INCFLAGS) $(GNATFLAGS) -gnatw.A ghdl_jit.adb $(GNAT_BARGS) -largs memsegs_c.o chkstk.o $(GRT_ADD_OBJS) $(LDFLAGS) $(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB) $(GRT_EXEC_OPTS))
+ $(GNATMAKE) -o $@ -gnat12 $(GHDL_MCODE_INCFLAGS) $(GNATFLAGS) -gnatw.A ghdl_jit.adb $(GNAT_BARGS) -largs memsegs_c.o chkstk.o $(GRT_ADD_OBJS) $(LDFLAGS) $(GNAT_LARGS) $(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB) $(GRT_EXEC_OPTS))

memsegs_c.o: $(srcdir)/src/ortho/mcode/memsegs_c.c
$(CC) -c $(COVERAGE_FLAGS) $(CFLAGS) -o $@ $<
@@ -314,7 +314,7 @@ ghdl1-gcc$(EXEEXT): version.ads force
ghdl_gcc$(EXEEXT): version.ads $(GRT_SYNTH_OBJS) force
$(GNATMAKE) $(GHDL_GCC_INCFLAGS) -aI$(srcdir)/src/ghdldrv \
$(GNATFLAGS) ghdl_gcc $(GNAT_BARGS) \
- -largs $(LDFLAGS) $(GRT_SYNTH_OBJS)
+ -largs $(LDFLAGS) $(GRT_SYNTH_OBJS) $(GNAT_LARGS)

libs.vhdl.local_gcc: ghdl_gcc$(EXEEXT) ghdl1-gcc$(EXEEXT)
$(MAKE) -f $(srcdir)/libraries/Makefile.inc $(LIBVHDL_FLAGS_TO_PASS) GHDL=$(PWD)/ghdl_gcc$(EXEEXT) GHDL_FLAGS="--GHDL1=$(PWD)/ghdl1-gcc$(EXEEXT) $(LIB_CFLAGS)" vhdl.libs.all libs.vhdl.standard
@@ -342,7 +342,7 @@ ghdl_llvm_jit$(EXEEXT): GRT_FLAGS+=-DWITH_GNAT_RUN_TIME
ghdl_llvm_jit$(EXEEXT): $(GRT_ADD_OBJS) $(GRT_SRC_DEPS) $(ORTHO_DEPS) \
llvm-cbindings.o version.ads force
$(GNATMAKE) -o $@ $(GHDL_LLVM_INCFLAGS) $(GNATFLAGS) ghdl_jit.adb \
- $(GNAT_BARGS) -largs llvm-cbindings.o $(GRT_ADD_OBJS) \
+ $(GNAT_BARGS) -largs llvm-cbindings.o $(GNAT_LARGS) $(GRT_ADD_OBJS) \
$(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB)) --LINK=$(CXX) \
`$(LLVM_CONFIG) --ldflags --libs --system-libs` $(LDFLAGS)

@@ -363,7 +363,7 @@ ghdl_llvm$(EXEEXT): version.ads $(GRT_SYNTH_OBJS) force
$(GNATMAKE) $(GHDL_LLVM_INCFLAGS) \
-aI$(srcdir)/src/ghdldrv $(GNATFLAGS) \
ghdl_llvm $(GNAT_BARGS) \
- -largs $(LDFLAGS) $(GRT_SYNTH_OBJS)
+ -largs $(LDFLAGS) $(GRT_SYNTH_OBJS) $(GNAT_LARGS)

ghdl1-llvm$(EXEEXT): version.ads force
$(MAKE) -f $(srcdir)/src/ortho/$(llvm_be)/Makefile \
@@ -400,7 +400,7 @@ uninstall.llvm: uninstall.llvm.program uninstall.grt
GHDL_SIMUL_INCFLAGS=$(GHDL_COMMON_INCFLAGS) -aI$(srcdir)/src/ghdldrv -aI$(srcdir)/src/vhdl/simulate -aI$(srcdir)/src/synth

ghdl_simul$(EXEEXT): $(GRT_ADD_OBJS) $(GRT_SRC_DEPS) version.ads force
- $(GNATMAKE) $(GHDL_SIMUL_INCFLAGS) $(GNATFLAGS) -gnat12 ghdl_simul $(GNAT_BARGS) -largs $(LDFLAGS) $(GRT_ADD_OBJS) $(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB))
+ $(GNATMAKE) $(GHDL_SIMUL_INCFLAGS) $(GNATFLAGS) -gnat12 ghdl_simul $(GNAT_BARGS) -largs $(LDFLAGS) $(GNAT_LARGS) $(GRT_ADD_OBJS) $(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB))

libs.vhdl.simul: ghdl_simul$(EXEEXT)
$(MAKE) -f $(srcdir)/libraries/Makefile.inc $(LIBVHDL_FLAGS_TO_PASS) GHDL=$(PWD)/ghdl_simul$(EXEEXT) GHDL_FLAGS="" VHDLLIBS_COPY_OBJS=no vhdl.libs.all
diff --git a/scripts/windows/mcode/Makefile.in b/scripts/windows/mcode/Makefile.in
index 0f7b7422..be1f1151 100644
--- a/scripts/windows/mcode/Makefile.in
+++ b/scripts/windows/mcode/Makefile.in
@@ -14,7 +14,7 @@ GRTSRCDIR=grt
####grt Makefile.inc

ghdl_mcode: default_paths.ads $(GRT_ADD_OBJS) mmap_binding.o force
- gnatmake -aIghdldrv -aIghdl -aIortho -aIgrt $(GNATFLAGS) ghdl_mcode $(GNAT_BARGS) -largs mmap_binding.o $(GRT_ADD_OBJS) $(GRT_EXTRA_LIB) -Wl,--version-script=$(GRTSRCDIR)/grt.ver -Wl,--export-dynamic
+ gnatmake -aIghdldrv -aIghdl -aIortho -aIgrt $(GNATFLAGS) ghdl_mcode $(GNAT_BARGS) -largs mmap_binding.o $(GNAT_LARGS) $(GRT_ADD_OBJS) $(GRT_EXTRA_LIB) -Wl,--version-script=$(GRTSRCDIR)/grt.ver -Wl,--export-dynamic

mmap_binding.o: ortho/mmap_binding.c
$(CC) -c -g -o $@ $<
File renamed without changes.
8 changes: 6 additions & 2 deletions scripts/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,15 @@ function strip_binaries() {
then
local dst_file=$PACKAGE_DIR/${NAME}_symbols/$path.dSYM
dsymutil -o $dst_file $src_file
strip $src_file
if [ $STRIP_SYMBOLS == "1" ]; then
strip $src_file
fi
else
local dst_file=$PACKAGE_DIR/${NAME}_symbols/$path.debug
objcopy --only-keep-debug "${src_file}" "${dst_file}"
strip $src_file --strip-debug --strip-unneeded
if [ $STRIP_SYMBOLS == "1" ]; then
strip $src_file --strip-debug --strip-unneeded
fi
fi
done
}
Expand Down
6 changes: 3 additions & 3 deletions scripts/compile_dfu_util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ if [ $ARCH == "darwin" ]; then
--includedir=/opt/local/include \
USB_CFLAGS="-I$LIBUSB_ROOT/include/libusb-1.0" \
USB_LIBS="$LIBUSB_ROOT/lib/libusb-1.0.a -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
$MAKE
$MAKE SUBDIRS=src
elif [ ${ARCH:0:7} = "windows" ]
then
./configure USB_LIBS="-static -lpthread -lusb-1.0"
$MAKE
$MAKE SUBDIRS=src
else
./configure USB_CFLAGS="-I$WORK_DIR/build-data/include/libusb-1.0" USB_LIBS="-static $WORK_DIR/build-data/lib/$ARCH/libusb-1.0.a -lpthread"
$MAKE
$MAKE SUBDIRS=src
fi

TOOLS="dfu-util dfu-prefix dfu-suffix"
Expand Down
3 changes: 2 additions & 1 deletion scripts/compile_ghdl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ cd $BUILD_DIR/$dir_name
# remove unwanted -lz linker flag on Darwin (because it causes a dynamic link)
$SED -i 's/^[ \t]*pragma Linker_Options ("-lz");//;' ./src/grt/grt-zlib.ads
# customise the version string for ghdl
patch -p1 < $WORK_DIR/scripts/ghdl_version.diff
patch -p1 < $WORK_DIR/patches/ghdl/ghdl_version.patch
patch -p1 < $WORK_DIR/patches/ghdl/ghdl_largs.patch

export GHDL_DESC="$(git -C $UPSTREAM_DIR/$dir_name describe --dirty 2> /dev/null)"
sed -i -e "s/@BUILDER@/open-tool-forge.$VERSION/" src/version.in
Expand Down
7 changes: 5 additions & 2 deletions scripts/compile_yosys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e -x

dir_name=yosys
commit=master
# commit=5eff0b73ae82ee490be3e732241eb22cb4bff952
git_url=https://github.com/YosysHQ/yosys.git

dir_name_gyp=ghdl_yosys_plugin
Expand All @@ -25,7 +26,7 @@ MAKEFILE_CONF_GHDL=
GHDL_LDLIBS=
if [ $COMPILE_GHDL == "1" ]
then
patch < $WORK_DIR/scripts/yosys_ghdl.diff
patch < $WORK_DIR/patches/yosys/yosys_ghdl.patch

mkdir -p frontends/ghdl
cp -R ../$dir_name_gyp/src/* frontends/ghdl
Expand Down Expand Up @@ -67,7 +68,9 @@ elif [ ${ARCH:0:7} == "windows" ]; then
ARCHFLAGS=\"$ABC_ARCHFLAGS\" \
ABC_USE_NO_READLINE=1 \
ABC_USE_NO_PTHREADS=1 \
ABC_USE_LIBSTDCXX=1" \
ABC_USE_LIBSTDCXX=1 \
OPTFLAGS=\"-ggdb -O0\" \
ABC_MAKE_VERBOSE=1" \
ENABLE_TCL=0 ENABLE_PLUGINS=0 ENABLE_READLINE=0 ENABLE_COVER=0 ENABLE_ZLIB=0 ENABLE_ABC=1 \
PYTHON="./bin/python3-private.exe" # override the shebang telling the exe launcher where to find python

Expand Down
2 changes: 1 addition & 1 deletion scripts/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ if [ $ARCH == "windows_x86" ]; then
fi

if [ $ARCH == "windows_amd64" ]; then
pacman --noconfirm --needed -S git base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake \
pacman --noconfirm --needed --refresh --sync -S git base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake \
mingw-w64-x86_64-boost mingw-w64-x86_64-eigen3 rsync unzip zip mingw-w64-x86_64-libftdi bison flex \
mingw-w64-x86_64-gcc-ada p7zip mingw-w64-x86_64-jsoncpp

Expand Down