On Sat, May 30, 2015 at 1:09 AM, Peter Maydell <peter.mayd...@linaro.org> wrote:
> On 29 May 2015 at 19:01, Jun Koi <junkoi2...@gmail.com> wrote: > > I always thought that Qemu never has C++ code inside, but I am surprise > to > > see this when Aarch64 emulator is linked, as following (excerpt) > > The AArch64 disassembler is written in C++ (this is a third > party bit of code which we include in QEMU). C++ is optional > as a build dependency, though -- if there's no C++ compiler > available configure will disable the AArch64 disassembler. > Oh, exactly which code is the AArch64 disassembler? I looked at target-arm/*.c, but did not seem to find C++ code there. I must missed it ... Thanks. > > c++ -I/usr/include/pixman-1 -I/home/me/projects/qemu-2.3.0/dtc/libfdt > > -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE > > -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings > > -Wmissing-prototypes -fno-strict-aliasing -fno-common -Wendif-labels > > -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security > > -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration > > -Wold-style-definition -Wtype-limits -fstack-protector-all > > -I../linux-headers -I.. -I/home/me/projects/qemu-2.3.0/target-arm > > -DNEED_CPU_H -I/home/me/projects/qemu-2.3.0/include -O2 -U_FORTIFY_SOURCE > > -D_FORTIFY_SOURCE=2 -pthread -I/usr/include/glib-2.0 > > -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -Wl,--warn-common > > -Wl,-z,relro -Wl,-z,now -pie -m64 -g -o qemu-system-aarch64 exec.o > > translate-all.o cpu-exec.o ... > > > > > > A question: is there any reason to use C++ for linker here? Why does C > > linker not work? > > If we are linking any C++-derived object then we must use the > C++ linker, otherwise the link might fail or not pull in the > right bits of the C++ runtime. (It's harmless to use the C++ > linker for a C-only link.) > > -- PMM >