Skip to content

Commit

Permalink
gac: remove support for static linking
Browse files Browse the repository at this point in the history
This has virtually no use case anymore since dynamic linking is supported
everywhere. At the same time it is an impediment for `make install` support.
So it just doesn't seem worth the effort to preserve it.
  • Loading branch information
fingolfin committed Feb 21, 2022
1 parent 5f7dd23 commit 49ef9ee
Show file tree
Hide file tree
Showing 14 changed files with 6 additions and 7,063 deletions.
2 changes: 0 additions & 2 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -763,8 +763,6 @@ GAP_CPPFLAGS="$(GAP_PKG_CPPFLAGS)"
GAP_LDFLAGS="$(GAP_LDFLAGS)"
GAP_LIBS="$(GAP_LIBS)"

GAP_OBJS="$(OBJS)"

JULIA="$(JULIA)"
JULIA_CPPFLAGS="$(JULIA_CPPFLAGS)"
JULIA_LDFLAGS="$(JULIA_LDFLAGS)"
Expand Down
86 changes: 6 additions & 80 deletions cnf/gac.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ libtool="@SHELL@ ${abs_top_builddir}/libtool"
# These three should be filled in by the standard autoconf procedures
c_compiler="$libtool --mode=compile $GAP_CC"
cxx_compiler="$libtool --mode=compile $GAP_CXX"
c_linker="$libtool --mode=link $GAP_CC -export-dynamic"

# These will need special care
c_dyn_linker="$libtool --mode=link $GAP_CC -module -avoid-version -rpath $libdir"
Expand Down Expand Up @@ -134,24 +133,11 @@ c_link_dyn () {
}


#############################################################################
##
#F c_link <output> <inputs_o>
##
c_link () {
mkdir -p $(dirname $1)
echo ${c_linker} ${GAP_LDFLAGS} -o $1 $2 ${GAP_LIBS}
${c_linker} ${GAP_LDFLAGS} -o $1 $2 ${GAP_LIBS} || exit 1
}

#############################################################################
##
#F process_o_file <basename> <filename>
##
## Compile according to comp_mode and comp_howfar
##
## This does everything except the final link phase in the static case
## in that case it adds the basename and object file path of $names and $objects
##

process_o_file () {
Expand All @@ -171,9 +157,6 @@ process_o_file () {
#F process_c_file <basename> <filename>
##
## Compile according to comp_mode and comp_howfar
##
## This does everything except the final link phase in the static case
## in that case it adds the basename and object file path of $names and $objects
##

process_c_file () {
Expand Down Expand Up @@ -224,9 +207,6 @@ process_cxx_file () {
#F process_gap_file <filename> <ext>
##
## Compile according to comp_mode and comp_howfar
##
## This does everything except the final link phase in the static case
## in that case it adds the basename and object file path of $names and $objects
##

process_gap_file () {
Expand Down Expand Up @@ -329,49 +309,6 @@ if [ "X${inputs}" = "X" ]; then
fi




#############################################################################
##
#F make_compstat
##

make_compstat () {
# make 'compstat.c' and compile it
temps_c="${temps_c} ${gactmp}/$$compstat.c"
(
echo "/* made by 'gac', can be thrown away */"
echo "#include \"compiled.h\""

echo "extern StructInitInfo * Init__type1 ( void );"
echo "extern StructInitInfo * Init__oper1( void );"

for name in ${names}; do
echo "extern StructInitInfo * Init__${name} ( void );"
done

echo "InitInfoFunc CompInitFuncs[] = {"
echo " Init__type1,"
echo " Init__oper1,"

for name in ${names}; do
echo " Init__${name},"
done
echo " 0"
echo "};"
) > ${gactmp}/$$compstat.c

temps_o="${gactmp}/$$compstat.lo ${temps_o}"
c_compile ${gactmp}/$$compstat.o ${gactmp}/$$compstat.c "${GAP_CFLAGS}"
if [ "$savetemps" = "true" ]; then
echo "Leaving temp file " ${gactmp}/$$compstat.c
else
echo rm -f ${gactmp}/$$compstat.c
rm -f ${gactmp}/$$compstat.c
fi
objects="${gactmp}/$$compstat.lo ${objects}"
}

make_tmpdir () {
if command -v mktemp >/dev/null 2>&1 ; then
gactmp=$(mktemp -d -t "gacXXXXXXX")
Expand Down Expand Up @@ -430,26 +367,15 @@ for input in ${inputs}; do
done


# static link phase
# link phase
if [ $comp_howfar = "link" ]; then
if [ $comp_mode = "comp_static" ]; then
make_compstat

# link everything together
if [ "X${output}" = "X" ]; then output="gacout"; fi

for object in $GAP_OBJS; do
if [ ${object} != "build/obj/src/compstat.c.lo" ]; then
objects="${abs_top_builddir}/${object} ${objects}"
fi
done

c_link ${output} "${objects}"

else
if [ "X${output}" = "X" ]; then output="${name}.la"; fi
c_link_dyn ${output} "${objects}"
echo "$0: static linking is not supported anymore, use -d / --dynamic"
exit 1
fi

if [ "X${output}" = "X" ]; then output="${name}.la"; fi
c_link_dyn ${output} "${objects}"

if [ "$savetemps" = "true" ]; then
echo "Leaving object files " ${temps_o}
Expand Down
2 changes: 0 additions & 2 deletions tst/test-compile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ These tests are designed to check the GAP -> C compiler

./run_compiled_dynamic.sh : Run a single test, after compiling it
into a dynamic module and loading it
./run_compiled_static.sh : Run a single test, after compiling it
into a static module and loading it
./run_interpreted.sh : Run a single test without compiling it

./run_all.sh : Run all tests with and without compiling
Expand Down
Loading

0 comments on commit 49ef9ee

Please sign in to comment.