mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-18 02:38:37 +00:00
Fix static linking by creating libr_shlr.a and stripping sdb and tcc from them
This exposes some implicit static linking of libs, and also shows that librz.a can be removed or generalized into using the partial-ld appraoch. Still issues with pkg-config because libr_shlr is only available as a static library and can be used in libr_util.pc, creating an empty libr_shlr.${EXT_SO} may simplify the problem but still a workaround. It is dangerous to link against it results in much bigger builds (also faster), which requires LTO to get adjusted sizes.
This commit is contained in:
parent
173c7ee49f
commit
d5ec745276
@ -40,7 +40,9 @@ libr.${EXT_SO}:
|
|||||||
rm -rf .libr/tcc # WHY
|
rm -rf .libr/tcc # WHY
|
||||||
$(CC) $(LDFLAGS) -shared -dynamic -arch arm64 -o libr.${EXT_SO} .libr/*/*.o ../shlr/gdb/lib/libgdbr.a
|
$(CC) $(LDFLAGS) -shared -dynamic -arch arm64 -o libr.${EXT_SO} .libr/*/*.o ../shlr/gdb/lib/libgdbr.a
|
||||||
|
|
||||||
libr.${EXT_AR}: $(wildcard */libr_*.${EXT_AR}) $(shell find ../shlr -name '*.${EXT_AR}')
|
#libr.${EXT_AR}: $(wildcard */libr_*.${EXT_AR}) $(shell find ../shlr -name '*.${EXT_AR}')
|
||||||
|
#libr.${EXT_AR}: $(wildcard */libr_*.${EXT_AR}) $(shell find ../shlr -name '*.${EXT_AR}') ../shlr/libr_shlr.${EXT_AR}
|
||||||
|
libr.${EXT_AR}: $(wildcard */libr_*.${EXT_AR}) ../shlr/libr_shlr.${EXT_AR}
|
||||||
rm -rf .libr
|
rm -rf .libr
|
||||||
mkdir .libr
|
mkdir .libr
|
||||||
for LIB in $^ ; do \
|
for LIB in $^ ; do \
|
||||||
|
@ -195,10 +195,9 @@ tcc-sync sync-tcc:
|
|||||||
$(GIT) add tcc
|
$(GIT) add tcc
|
||||||
rm -rf _
|
rm -rf _
|
||||||
|
|
||||||
install:
|
install: libr_shlr.${EXT_AR}
|
||||||
#mkdir -p ${DESTDIR}${LIBDIR}
|
mkdir -p ${DESTDIR}/${LIBDIR}
|
||||||
#cp -f tcc/libr_tcc* ${DESTDIR}${LIBDIR}
|
cp -f libr_shlr.${EXT_AR} ${DESTDIR}/${LIBDIR}
|
||||||
#cp -f zip/libr_z* ${DESTDIR}${LIBDIR}
|
|
||||||
|
|
||||||
install-symlink symstall:
|
install-symlink symstall:
|
||||||
mkdir -p "${DESTDIR}${LIBDIR}"
|
mkdir -p "${DESTDIR}${LIBDIR}"
|
||||||
@ -206,8 +205,7 @@ install-symlink symstall:
|
|||||||
# ln -fs `pwd`/$$FILE ${DESTDIR}${LIBDIR}/$$FILE ; done
|
# ln -fs `pwd`/$$FILE ${DESTDIR}${LIBDIR}/$$FILE ; done
|
||||||
|
|
||||||
uninstall deinstall:
|
uninstall deinstall:
|
||||||
#rm -f ${DESTDIR}${LIBDIR}/libr_tcc*
|
rm -f ${DESTDIR}${LIBDIR}/libr_shlr.${EXT_AR}
|
||||||
#rm -f ${DESTDIR}${LIBDIR}/libr_z*
|
|
||||||
|
|
||||||
ifeq ($(USE_CAPSTONE),1)
|
ifeq ($(USE_CAPSTONE),1)
|
||||||
# Do nothing here
|
# Do nothing here
|
||||||
@ -313,4 +311,25 @@ spp-sync sync-spp:
|
|||||||
spp: spp-sync
|
spp: spp-sync
|
||||||
CFLAGS="-DHAVE_FORK=${HAVE_FORK} -fPIC" $(MAKE) -C spp
|
CFLAGS="-DHAVE_FORK=${HAVE_FORK} -fPIC" $(MAKE) -C spp
|
||||||
|
|
||||||
|
SHLRS+=ar/libr_ar.a
|
||||||
|
SHLRS+=bochs/lib/libbochs.a
|
||||||
|
SHLRS+=capstone/libcapstone.a
|
||||||
|
SHLRS+=gdb/lib/libgdbr.a
|
||||||
|
SHLRS+=grub/libgrubfs.a
|
||||||
|
SHLRS+=java/libr_java.a
|
||||||
|
SHLRS+=lz4/liblz4.a
|
||||||
|
SHLRS+=qnx/lib/libqnxr.a
|
||||||
|
#SHLRS+=sdb/src/libsdb.a
|
||||||
|
#SHLRS+=tcc/libr_tcc.a
|
||||||
|
SHLRS+=windbg/libr_windbg.a
|
||||||
|
SHLRS+=zip/librz.a
|
||||||
|
|
||||||
|
libr_shlr.${EXT_AR}:
|
||||||
|
rm -rf .libr
|
||||||
|
mkdir .libr
|
||||||
|
for LIB in ${SHLRS} ; do \
|
||||||
|
${PARTIALLD} -o .libr/$$(basename $${LIB} .a).o $${LIB} ; \
|
||||||
|
done
|
||||||
|
${AR} crs $@ .libr/*.o
|
||||||
|
|
||||||
.PHONY: spp
|
.PHONY: spp
|
||||||
|
Loading…
Reference in New Issue
Block a user