public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: "LV, XIAN" <xian.lv@alliance-rd.cn>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: Hi Tom , May I ask two questions about gdb compiling
Date: Mon, 3 May 2021 08:35:30 +0200	[thread overview]
Message-ID: <73b5853e-cc47-6e5b-fc3f-42154bd0773f@suse.de> (raw)
In-Reply-To: <9E8E160C0BCE694BA44854DA190BB1C41FC46B61@CN-EX-MB-002.NCIC.local>

[ 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
>>>>make
> 
> 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*
> 

Hi,

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
(0x00007f6588e1c000)
...

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. ]

Thanks,
- Tom

           reply	other threads:[~2021-05-03  6:35 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <9E8E160C0BCE694BA44854DA190BB1C41FC46B61@CN-EX-MB-002.NCIC.local>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=73b5853e-cc47-6e5b-fc3f-42154bd0773f@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb@sourceware.org \
    --cc=xian.lv@alliance-rd.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).