Re: [Qemu-devel] [RFC PATCH 3/3] Introduce libtcg infrastructure
On Tue, 24 Jan 2017 10:08:56 + Marc-André Lureauwrote: > > > * If there's at least a *-libtcg, compile everything as position > > independent code. > > why not limit it to libtcg code? > At least we have to enable it on "common" object files (those compiled only once, independently from the current target), therefore I see little benefit in compiling without PIC other object files. I also think it might be a good idea to switch to PIE executables altogether. > > > * In case we're building libtcg, install the output binary in the > > $PREFIX/lib directory instead of $PREFIX/bin. > > > > If it's installed globally, I think we have to deal with versioning, > common prefix, and list of visible symbols. > Yeah, for symbol visibility I was thinking to force all the symbols to be hidden except for those in tcg.c, which would have a `tcg_` prefix. I didn't think about versioning yet. > > What's the plan with this tcg.c? Shouldn't the functions be stubs or > library user callbacks? > > What is test() doing? > > Please add a libtcg test under tests/ (even minimal, like a basic > translate/dump). > This patch was to get a first round of opinions. The test function was only supposed to reference some functions I know I'll use to make sure that I'm linking in all the required object files. In the next set of patches I'll provide something that actually does something. > > > > > ifdef CONFIG_USER_ONLY > > +ifdef CONFIG_LIBTCG > > +# libtcg > > +QEMU_PROG=libtcg-$(TARGET_NAME)$(DSOSUF) > > +QEMU_PROG_BUILD = $(QEMU_PROG) > > +QEMU_CFLAGS+=-fPIC > > + > > +# Change the install directory > > +PROGS_INSTALL_DIR := $(libdir) > > > > okay, we may want to rename it to something like QEMU_BUILD perhaps > You mean the QEMU_PROG_BUILD? ACK. > > > install: all > > +ifdef CONFIG_LIBTINYCODE > > + $(INSTALL_DATA) $(SRC_PATH)/tcg/tcg-opc.h > > $(SRC_PATH)/libtcg/tcg.h "$(DESTDIR)$(includedir)" > > +endif > > > > LIBTINYCODE/LIBTCG? > Leftover from my internal version. > > > -crypto-obj-y += aes.o > > +crypto-obj-$(call lnot,$(CONFIG_LIBTCG)) += aes.o > > > > why that change? > aes.o was being linked in, but we don't use it in LIBTCG. Maybe this should be fixed in an higher level. > > > diff --git a/libtcg/tcg.h b/libtcg/tcg.h > > new file mode 100644 > > index 00..e69de29bb2 > > > > What is this empty file for? > Just a placeholder for the header file to install. This patch goal was to show all the changes to the build system. Thanks for the comments. -- Alessandro Di Federico PhD student at Politecnico di Milano
Re: [Qemu-devel] [RFC PATCH 3/3] Introduce libtcg infrastructure
Hi On Sat, Jan 21, 2017 at 12:46 PM Alessandro Di Federico < ale+q...@clearmind.me> wrote: > [This is a draft patch is for review purposes only] > > * Extend the build system to build libtcg-$arch.so dynamic libraries. > It would be nice to link qemu-user with it, it could be done later. * Introduce --enable-libtcg and --disable-libtcg the *-libtcg target, > similar to *-linux-user and *-bsd-user, since it enables > CONFIG_USER_ONLY, but uses only the TCG frontends (in particular the > various /target/$arch/translate.c). > * If there's at least a *-libtcg, compile everything as position > independent code. > why not limit it to libtcg code? > * In case we're building libtcg, install the output binary in the > $PREFIX/lib directory instead of $PREFIX/bin. > If it's installed globally, I think we have to deal with versioning, common prefix, and list of visible symbols. * Reduce the number of object files linked into libtcg-$arch.so to the > minimum. > * Install the tcg.h header to use libtcg. > * Create libtcg/, with a draft function referencing the functions that > libtcg would use. > What's the plan with this tcg.c? Shouldn't the functions be stubs or library user callbacks? What is test() doing? Please add a libtcg test under tests/ (even minimal, like a basic translate/dump). --- > Makefile| 7 + > Makefile.target | 40 +--- > configure | 20 > crypto/Makefile.objs| 2 +- > default-configs/aarch64-libtcg.mak | 0 > default-configs/alpha-libtcg.mak| 0 > default-configs/arm-libtcg.mak | 0 > default-configs/armeb-libtcg.mak| 0 > default-configs/cris-libtcg.mak | 0 > default-configs/i386-libtcg.mak | 0 > default-configs/m68k-libtcg.mak | 0 > default-configs/microblaze-libtcg.mak | 0 > default-configs/microblazeel-libtcg.mak | 0 > default-configs/mips-libtcg.mak | 0 > default-configs/mips64-libtcg.mak | 0 > default-configs/mips64el-libtcg.mak | 0 > default-configs/mipsel-libtcg.mak | 0 > default-configs/mipsn32-libtcg.mak | 0 > default-configs/mipsn32el-libtcg.mak| 0 > default-configs/or32-libtcg.mak | 0 > default-configs/ppc-libtcg.mak | 1 + > default-configs/ppc64-libtcg.mak| 1 + > default-configs/ppc64abi32-libtcg.mak | 1 + > default-configs/ppc64le-libtcg.mak | 1 + > default-configs/s390x-libtcg.mak| 0 > default-configs/sh4-libtcg.mak | 0 > default-configs/sh4eb-libtcg.mak| 0 > default-configs/sparc-libtcg.mak| 0 > default-configs/sparc32plus-libtcg.mak | 0 > default-configs/sparc64-libtcg.mak | 0 > default-configs/unicore32-libtcg.mak| 0 > default-configs/x86_64-libtcg.mak | 0 > hw/core/Makefile.objs | 5 ++- > include/exec/helper-gen.h | 12 +++ > include/exec/helper-head.h | 8 + > include/exec/helper-tcg.h | 12 +++ > libtcg/Makefile.objs| 1 + > libtcg/qemu.h | 6 > libtcg/tcg.c| 55 > + > libtcg/tcg.h| 0 > target/alpha/Makefile.objs | 9 -- > target/arm/Makefile.objs| 22 + > target/cris/Makefile.objs | 10 -- > target/i386/Makefile.objs | 14 ++--- > target/lm32/Makefile.objs | 12 +-- > target/m68k/Makefile.objs | 7 - > target/microblaze/Makefile.objs | 10 -- > target/mips/Makefile.objs | 11 +-- > target/moxie/Makefile.objs | 8 - > target/openrisc/Makefile.objs | 11 +-- > target/ppc/Makefile.objs| 18 +-- > target/ppc/translate.c | 2 ++ > target/ppc/translate_init.c | 8 + > target/s390x/Makefile.objs | 16 +++--- > target/sh4/Makefile.objs| 8 - > target/sparc/Makefile.objs | 15 ++--- > target/tilegx/Makefile.objs | 7 - > target/tricore/Makefile.objs| 7 - > target/unicore32/Makefile.objs | 8 +++-- > target/xtensa/Makefile.objs | 14 ++--- > trace/Makefile.objs | 2 +- > translate-all.c | 4 ++- > 62 files changed, 322 insertions(+), 73 deletions(-) > create mode 100644 default-configs/aarch64-libtcg.mak > create mode 100644 default-configs/alpha-libtcg.mak > create mode 100644 default-configs/arm-libtcg.mak > create mode 100644 default-configs/armeb-libtcg.mak > create mode 100644 default-configs/cris-libtcg.mak > create mode 100644 default-configs/i386-libtcg.mak > create mode
[Qemu-devel] [RFC PATCH 3/3] Introduce libtcg infrastructure
[This is a draft patch is for review purposes only] * Extend the build system to build libtcg-$arch.so dynamic libraries. * Introduce --enable-libtcg and --disable-libtcg the *-libtcg target, similar to *-linux-user and *-bsd-user, since it enables CONFIG_USER_ONLY, but uses only the TCG frontends (in particular the various /target/$arch/translate.c). * If there's at least a *-libtcg, compile everything as position independent code. * In case we're building libtcg, install the output binary in the $PREFIX/lib directory instead of $PREFIX/bin. * Reduce the number of object files linked into libtcg-$arch.so to the minimum. * Install the tcg.h header to use libtcg. * Create libtcg/, with a draft function referencing the functions that libtcg would use. --- Makefile| 7 + Makefile.target | 40 +--- configure | 20 crypto/Makefile.objs| 2 +- default-configs/aarch64-libtcg.mak | 0 default-configs/alpha-libtcg.mak| 0 default-configs/arm-libtcg.mak | 0 default-configs/armeb-libtcg.mak| 0 default-configs/cris-libtcg.mak | 0 default-configs/i386-libtcg.mak | 0 default-configs/m68k-libtcg.mak | 0 default-configs/microblaze-libtcg.mak | 0 default-configs/microblazeel-libtcg.mak | 0 default-configs/mips-libtcg.mak | 0 default-configs/mips64-libtcg.mak | 0 default-configs/mips64el-libtcg.mak | 0 default-configs/mipsel-libtcg.mak | 0 default-configs/mipsn32-libtcg.mak | 0 default-configs/mipsn32el-libtcg.mak| 0 default-configs/or32-libtcg.mak | 0 default-configs/ppc-libtcg.mak | 1 + default-configs/ppc64-libtcg.mak| 1 + default-configs/ppc64abi32-libtcg.mak | 1 + default-configs/ppc64le-libtcg.mak | 1 + default-configs/s390x-libtcg.mak| 0 default-configs/sh4-libtcg.mak | 0 default-configs/sh4eb-libtcg.mak| 0 default-configs/sparc-libtcg.mak| 0 default-configs/sparc32plus-libtcg.mak | 0 default-configs/sparc64-libtcg.mak | 0 default-configs/unicore32-libtcg.mak| 0 default-configs/x86_64-libtcg.mak | 0 hw/core/Makefile.objs | 5 ++- include/exec/helper-gen.h | 12 +++ include/exec/helper-head.h | 8 + include/exec/helper-tcg.h | 12 +++ libtcg/Makefile.objs| 1 + libtcg/qemu.h | 6 libtcg/tcg.c| 55 + libtcg/tcg.h| 0 target/alpha/Makefile.objs | 9 -- target/arm/Makefile.objs| 22 + target/cris/Makefile.objs | 10 -- target/i386/Makefile.objs | 14 ++--- target/lm32/Makefile.objs | 12 +-- target/m68k/Makefile.objs | 7 - target/microblaze/Makefile.objs | 10 -- target/mips/Makefile.objs | 11 +-- target/moxie/Makefile.objs | 8 - target/openrisc/Makefile.objs | 11 +-- target/ppc/Makefile.objs| 18 +-- target/ppc/translate.c | 2 ++ target/ppc/translate_init.c | 8 + target/s390x/Makefile.objs | 16 +++--- target/sh4/Makefile.objs| 8 - target/sparc/Makefile.objs | 15 ++--- target/tilegx/Makefile.objs | 7 - target/tricore/Makefile.objs| 7 - target/unicore32/Makefile.objs | 8 +++-- target/xtensa/Makefile.objs | 14 ++--- trace/Makefile.objs | 2 +- translate-all.c | 4 ++- 62 files changed, 322 insertions(+), 73 deletions(-) create mode 100644 default-configs/aarch64-libtcg.mak create mode 100644 default-configs/alpha-libtcg.mak create mode 100644 default-configs/arm-libtcg.mak create mode 100644 default-configs/armeb-libtcg.mak create mode 100644 default-configs/cris-libtcg.mak create mode 100644 default-configs/i386-libtcg.mak create mode 100644 default-configs/m68k-libtcg.mak create mode 100644 default-configs/microblaze-libtcg.mak create mode 100644 default-configs/microblazeel-libtcg.mak create mode 100644 default-configs/mips-libtcg.mak create mode 100644 default-configs/mips64-libtcg.mak create mode 100644 default-configs/mips64el-libtcg.mak create mode 100644 default-configs/mipsel-libtcg.mak create mode 100644 default-configs/mipsn32-libtcg.mak create mode 100644 default-configs/mipsn32el-libtcg.mak create mode 100644 default-configs/or32-libtcg.mak create mode 100644 default-configs/ppc-libtcg.mak create mode 100644 default-configs/ppc64-libtcg.mak create mode 100644 default-configs/ppc64abi32-libtcg.mak