Hi Tom , May I ask two questions about gdb compiling

Tom de Vries tdevries@suse.de
Mon May 3 06:35:30 GMT 2021

[ CC-ing gdb mailing list ]

On 5/3/21 7:26 AM, LV, XIAN wrote:
> Dear Tom,
>     Sorry for disturbing.
>     Now I try to compile the gdb-10.2 which downloaded from official
> website and the compiling is successful.
>>>>./configure --target=aarch64-linux-gnu --host=aarch64-linux-gnu
> --build=x86_64-linux-gnu --prefix=/home/rex/gdb-10.2
> But there are two questions:
> *1.  How can I modify the path of dynamic interpreter:*
> rex@rex-desktop:/project/gdb-10.2/build$ file gdb/gdb
> gdb/gdb: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux),
> dynamically linked, interpreter */lib/ld-linux-aarch64.so.1,* for
> GNU/Linux 3.7.0, BuildID[sha1]=1f80eff7276d6bb5ee3482675502770887a210f2,
> with debug_info, not stripped
> from */lib/ld-linux-aarch64.so.1 to /system/bin/linker64*


I did the following experiment:
$ gcc ~/hello.c -g
$ ldd ./a.out
        linux-vdso.so.1 (0x00007ffe353ca000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f7bebbdb000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f7bebf96000)
$ /lib64/ld-linux-x86-64.so.2 --list ./a.out
        linux-vdso.so.1 (0x00007ffd02126000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f88ba87f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f88bac3a000)
$ /lib64/ld-lsb-x86-64.so.3 --list ./a.out
        linux-vdso.so.1 (0x00007ffe875fb000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f6588a61000)
        /lib64/ld-linux-x86-64.so.2 => /lib64/ld-lsb-x86-64.so.3

So, ISTM that you can override the dynamic linker used by adding it on
the command line before the command you're trying to run.

> *2. How can I compile the gdb tools with all dynamic library included in
> the gdb execution file (Just use the libraries in static way)*
>     Thank you so much.

No idea.  It may be possible.  OTOH, it may be a better idea to look
into concepts like containers, if your actual concern is to be able to
package an executable with all its dependencies.

[ FWIW, note btw that both your questions are more related to using
linux than to gdb itself.  So perhaps you'll able to find more or more
elaborate answers to your questions in the generic information available
for linux. ]

- Tom

More information about the Gdb mailing list