Cross compiling a static gdb with a recent binutils
Alastair Hughes <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm trying to cross compile a static gdb (gdb 7.11.1). Unfortunately, due to a recent change in binutils, my current configuration builds a dynamically linked gdb, despite there being no dynamic loader on the target system.
The change in binutils seems to be intentional (see https://gcc.gnu.org/ml/gcc-help/2016-08/msg00036.html).
However, due to the change, I end up with a dynamically linked executable which is not loadable on the target system. This happens even when passing -static, and appears to be caused by the "-Wl,--dynamic-list=./proc-service.list" argument to gdb given when building gdb and gdbserver.
I've had a poke around the configure script and there doesn't seem to be any obvious way of disabling this behavior. Have I missed something? What else can I try?
Here is the command use to link gdb:
mips-linux-musl-gcc -Os -ffunction-sections -fdata-sections -static --sysroot=/sysroot -static-libstdc++ -static-libgcc -Wl,-static,--gc-sections,-rpath,/sysroot/usr/lib,--sysroot,/sysroot -L/sysroot/usr/lib \
-o gdb *various object files* \
../sim/mips/libsim.a -lreadline ../opcodes/libopcodes.a ../bfd/libbfd.a -L./../zlib -lz ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -lncurses -lm ../libiberty/libiberty.a build-gnulib/import/libgnu.a -ldl -Wl,--dynamic-list=./proc-service.list
Here are the arguments I pass to configure:
./configure --prefix="/usr" \
--build="${_local_triplet}" \
--host="${_target_triplet}" \
--target="${_target_triplet}" \
--enable-static \
--disable-shared \
--disable-plugins \
--disable-multilib \
--disable-werror \
--disable-nls \
--with-system-gdbinit=/etc/gdb/gdbinit \
--with-system-readline \
--with-system-zlib
Alastair Hughes