This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
objcopy does not realloc all symbols with --change-addresses
- To: binutils at sources dot redhat dot com
- Subject: objcopy does not realloc all symbols with --change-addresses
- From: Trent Waddington <trentw at vmware dot com>
- Date: Wed, 21 Mar 2001 14:55:33 -0800 (PST)
Below is an example of the problem. Using --change-addresses to relocate
the symbols contained in a binary to a new location fails to relocate all
the symbols and in particular the symbols that gdb uses to calculate the
addresses of functions. This does not affect global variables.
bash$ cat blah.c
int lobster;
void blah() {
}
void main() {
}
bash$ gcc blah.c -o blah -gstabs
blah.c: In function `main':
blah.c:8: warning: return type of `main' is not `int'
bash$ objcopy -v --change-addresses 0xc0000000 blah blah1
copy from blah(elf32-i386) to blah1(elf32-i386)
bash$ ls -l
total 28
-rwxr-xr-x 1 trentw mts 12269 Mar 21 14:43 blah
-rw-r--r-- 1 trentw mts 50 Mar 21 14:43 blah.c
-rwxr-xr-x 1 trentw mts 12269 Mar 21 14:45 blah1
bash$ gdb ./blah
GNU gdb 19991004
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) p blah
$2 = {void ()} 0x80483ac <blah>
(gdb) p &lobster
$4 = (int *) 0x804950c
(gdb) quit
bash$ gdb ./blah1
GNU gdb 19991004
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) p blah
$1 = {void ()} 0x80483ac <blah>
(gdb) p &lobster
$2 = (int *) 0xc804950c
(gdb) quit