* relocations when doing file command at gdb prompt
@ 2007-03-07 16:16 Roland Puntaier
2007-03-08 15:22 ` Daniel Jacobowitz
0 siblings, 1 reply; 7+ messages in thread
From: Roland Puntaier @ 2007-03-07 16:16 UTC (permalink / raw)
To: gdb
Hi,
maybe someone can help me.
The Problem
-----------
I try to remote debug an embedded device with gdb.
(gdb) target remote XXX
I found that in
remote.c:
get_offsets(){...
objfiles.c:
objfile_relocate(){...
l->item[i].pc is quite out of range.
My investigations so far
------------------------
The pc value comes from the preceeding file command:
(gdb) file -readnow YYY
dbxread.c:
process_one_symbol(){...
function_start_offset = ANOFFSET (section_offsets,
SECT_OFF_TEXT (objfile));
...
case N_SLINE:...
valu += function_start_offset;
...
record_line(,,valu);
buildsym.c:
record_line(,,pc){...e->pc = ADDR_BITS_REMOVE(pc);
function_start_offset had twice the value it should have when
compared to objdump output.
The wrong values showed up first in
bfd/simple.c:
bfd_simple_get_relocated_section_contents(){...
contents = bfd_get_relocated_section_contents(){...
bfd/reloc.c:
bfd_generic_get_relocated_section_contents (reloc.c:4432){...
bfd_perform_relocation{...
symbol = *(reloc_entry->sym_ptr_ptr);
...
relocation = symbol->value;
...
output_base = reloc_target_output_section->vma;
relocation += output_base + symbol->section->output_offset;
...
DOIT(x);
output_base had a value equal x, such that x got doubled.
x is section_offsets from above.
There is a branch, if symbol->section->output_section==0, that
makes output_base=0;
symbol->section->output_section gets its value from the
bfd_simple_get_relocated_section_contents
{...bfd_canonicalize_symtab()
{...elf_slurp_symbol_table (elfcode.h)
{...bfd_elf_get_elf_syms
...
sym->symbol.section = bfd_section_from_elf_index ()
{...return elf_elfsections
(abfd)[index]->bfd_section;
And bfd_section->output_section is filled in
symbol_file_command{...symbol_file_add_main_1{...symbol_file_add{...
symbol_file_add_from_bfd{...
symbol_file_add_with_addrs_or_offsets{...
syms_from_objfile()
{...elf_symfile_read (elfread.c)
{...elfstab_build_psymtabs (dbxread.c)
{...symfile_relocate_debug_section (symfile.c)
{...bfd_map_over_sections (abfd,
symfile_dummy_outputs, NULL);
I first thought to change symfile_dummy_outputs (symfile.c), by replacing
sectp->output_section = sectp;
with
sectp->output_section = NULL;
I tried this, but unfortunately later on in
bfd_simple_get_relocated_section_contents(simple.c:209),
(bfd_map_over_sections (abfd, simple_save_output_info, saved_offsets);)
which is called immediately afterwards from
symfile_relocate_debug_section,
output_section is set to section again. This time by bfd and not gdb.
I changed simple_save_output_info to set output_section=NULL.
And now linetable's pc had the value as in the file.
Question/Goal
-------------
Is there another way to make gdb/bfd consistently relocate symbol
information, when doing the gdb file command?
The best for me would be to have old_offset relative to the
beginning of the sections, then objfile_relocate would add
new_offset-old_offset, where new_offset would be the new address.
regards, Roland
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: relocations when doing file command at gdb prompt
2007-03-07 16:16 relocations when doing file command at gdb prompt Roland Puntaier
@ 2007-03-08 15:22 ` Daniel Jacobowitz
2007-03-08 15:49 ` Roland Puntaier
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2007-03-08 15:22 UTC (permalink / raw)
To: Roland Puntaier; +Cc: gdb
On Wed, Mar 07, 2007 at 05:16:02PM +0100, Roland Puntaier wrote:
> (gdb) file -readnow YYY
> dbxread.c:
> process_one_symbol(){...
> function_start_offset = ANOFFSET (section_offsets,
> SECT_OFF_TEXT (objfile));
> ...
> case N_SLINE:...
> valu += function_start_offset;
> ...
> record_line(,,valu);
> buildsym.c:
> record_line(,,pc){...e->pc = ADDR_BITS_REMOVE(pc);
> function_start_offset had twice the value it should have when
> compared to objdump output.
So, are you loading an object file or a linked program? Does it have
relocations included? It sounds sort of like this is a linked program
with --emit-relocs; I believe someone else reported a similar problem
earlier this year.
A test case is always very helpful.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: relocations when doing file command at gdb prompt
2007-03-08 15:22 ` Daniel Jacobowitz
@ 2007-03-08 15:49 ` Roland Puntaier
2007-03-08 16:05 ` Daniel Jacobowitz
0 siblings, 1 reply; 7+ messages in thread
From: Roland Puntaier @ 2007-03-08 15:49 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb
[-- Attachment #1: Type: text/plain, Size: 334 bytes --]
> So, are you loading an object file or a linked program?
An object file.
> Does it have relocations included?
Yes
I attach a dump (not with objdump) of the elf file and the elf file
itself.
When doing
(gdb) file NewProgram.out
(gdb) info line 29
you should get an address twice the value it should have.
Thanks for the reply.
[-- Attachment #2: elfdump.txt --]
[-- Type: text/plain, Size: 74013 bytes --]
----------File Header----------
[Elf32_Ehdr]
e_ident: \x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00
e_type: 0x3 --> ET_DYN
e_machine: 0x3 --> EM_386
e_version: 0x1
e_entry: 0x8048234
e_phoff: 0x34
e_shoff: 0xD40
e_flags: 0x0
e_ehsize: 0x34
e_phentsize: 0x20
e_phnum: 0x5
e_shentsize: 0x28
e_shnum: 0x15
e_shstrndx: 0x12
----------Sections----------
[Elf32_Shdr]
sh_name: 0x0 -->
sh_type: 0x0 --> SHT_NULL
sh_flags: 0x0 -->
sh_addr: 0x0
sh_offset: 0x0 --> 0x0
sh_size: 0x0
sh_link: 0x0
sh_info: 0x0
sh_addralign: 0x0
sh_entsize: 0x0
Index: 0
----------Section Data----------
[Elf32_Shdr]
sh_name: 0x1B --> .interp
sh_type: 0x1 --> SHT_PROGBITS
sh_flags: 0x2 --> SHF_ALLOC
sh_addr: 0x80480D4
sh_offset: 0xD4 --> 0xE7
sh_size: 0x13
sh_link: 0x0
sh_info: 0x0
sh_addralign: 0x1
sh_entsize: 0x0
Index: 1
----------Section Data----------
2f 75 73 72 2f 6c 69 62 2f 6c 69 62 63 2e 73 6f
2e 31 00
[Elf32_Shdr]
sh_name: 0x23 --> .hash
sh_type: 0x5 --> SHT_HASH
sh_flags: 0x2 --> SHF_ALLOC
sh_addr: 0x80480E8
sh_offset: 0xE8 --> 0x12C
sh_size: 0x44
sh_link: 0x3
sh_info: 0x0
sh_addralign: 0x4
sh_entsize: 0x4
Index: 2
----------Section Data----------
03 00 00 00 0c 00 00 00 0a 00 00 00 0b 00 00 00
09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00
00 00 00 00 00 00 00 00 08 00 00 00 06 00 00 00
07 00 00 00
[Elf32_Shdr]
sh_name: 0x29 --> .dynsym
sh_type: 0xB --> SHT_DYNSYM
sh_flags: 0x2 --> SHF_ALLOC
sh_addr: 0x804812C
sh_offset: 0x12C --> 0x1EC
sh_size: 0xC0
sh_link: 0x4
sh_info: 0x5
sh_addralign: 0x4
sh_entsize: 0x10
Index: 3
----------Section Data----------
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x0
st_size: 0x0
st_info: 0x0 --> STB_LOCAL, STT_NOTYPE
st_other: 0x0
st_shndx: 0x0
IndexInTable: 0x0
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x80480D4
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x1
IndexInTable: 0x1
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x8048234
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x6
IndexInTable: 0x2
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x8049334
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0xB
IndexInTable: 0x3
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x8049334
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0xC
IndexInTable: 0x4
[Elf32_Sym]
st_name: 0x1 --> LOADERSTART
st_value: 0x8048234
st_size: 0x4
st_info: 0x11 --> STB_GLOBAL, STT_OBJECT
st_other: 0x0
st_shndx: 0xFFF1
IndexInTable: 0x5
[Elf32_Sym]
st_name: 0x3C --> i
st_value: 0x8049334
st_size: 0x4
st_info: 0x11 --> STB_GLOBAL, STT_OBJECT
st_other: 0x0
st_shndx: 0xC
IndexInTable: 0x6
[Elf32_Sym]
st_name: 0xD --> EXEOFFSET
st_value: 0x8048238
st_size: 0x0
st_info: 0x10 --> STB_GLOBAL, STT_NOTYPE
st_other: 0x0
st_shndx: 0x6
IndexInTable: 0x7
[Elf32_Sym]
st_name: 0x1E --> __bss_start
st_value: 0x8049334
st_size: 0x0
st_info: 0x10 --> STB_GLOBAL, STT_NOTYPE
st_other: 0x0
st_shndx: 0xFFF1
IndexInTable: 0x8
[Elf32_Sym]
st_name: 0x2A --> PLCVARIABLES
st_value: 0x8049338
st_size: 0x0
st_info: 0x10 --> STB_GLOBAL, STT_NOTYPE
st_other: 0x0
st_shndx: 0xFFF1
IndexInTable: 0x9
[Elf32_Sym]
st_name: 0x17 --> _edata
st_value: 0x8049334
st_size: 0x0
st_info: 0x10 --> STB_GLOBAL, STT_NOTYPE
st_other: 0x0
st_shndx: 0xFFF1
IndexInTable: 0xA
[Elf32_Sym]
st_name: 0x37 --> _end
st_value: 0x8049338
st_size: 0x0
st_info: 0x10 --> STB_GLOBAL, STT_NOTYPE
st_other: 0x0
st_shndx: 0xFFF1
IndexInTable: 0xB
[Elf32_Shdr]
sh_name: 0x31 --> .dynstr
sh_type: 0x3 --> SHT_STRTAB
sh_flags: 0x2 --> SHF_ALLOC
sh_addr: 0x80481EC
sh_offset: 0x1EC --> 0x22A
sh_size: 0x3E
sh_link: 0x0
sh_info: 0x0
sh_addralign: 0x1
sh_entsize: 0x0
Index: 4
----------Section Data----------
LOADERSTART
EXEOFFSET
_edata
__bss_start
PLCVARIABLES
_end
i
[Elf32_Shdr]
sh_name: 0x39 --> .rel.got
sh_type: 0x9 --> SHT_REL
sh_flags: 0x2 --> SHF_ALLOC
sh_addr: 0x804822C
sh_offset: 0x22C --> 0x234
sh_size: 0x8
sh_link: 0x3
sh_info: 0x9
sh_addralign: 0x4
sh_entsize: 0x8
Index: 5
----------Section Data----------
[Elf32_Rel]
r_offset: 0x8049324
r_info: 0x8 --> ELF32_R_SYM:0x0, ELF32_R_TYPE:0x8(R_386_RELATIVE)
[Elf32_Shdr]
sh_name: 0x46 --> .text
sh_type: 0x1 --> SHT_PROGBITS
sh_flags: 0x6 --> SHF_ALLOC|SHF_EXECINSTR
sh_addr: 0x8048234
sh_offset: 0x234 --> 0x2AC
sh_size: 0x78
sh_link: 0x0
sh_info: 0x0
sh_addralign: 0x4
sh_entsize: 0x0
Index: 6
----------Section Data----------
90 00 00 00 55 89 e5 8b 45 08 0f af 45 08 c9 c3
55 89 e5 53 83 ec 04 e8 00 00 00 00 5b 81 c3 d8
10 00 00 8b 83 fc ff ff ff c7 00 01 00 00 00 8b
83 fc ff ff ff 8b 00 8d 50 02 8b 83 fc ff ff ff
89 10 8b 83 fc ff ff ff 8b 00 83 ec 0c 50 e8 b1
ff ff ff 83 c4 10 89 c2 8b 83 fc ff ff ff 89 10
8b 83 fc ff ff ff 8b 00 8d 14 00 8b 83 fc ff ff
ff 89 10 8b 5d fc c9 c3
[Elf32_Shdr]
sh_name: 0x4C --> .dynamic
sh_type: 0x6 --> SHT_DYNAMIC
sh_flags: 0x3 --> SHF_WRITE|SHF_ALLOC
sh_addr: 0x80492AC
sh_offset: 0x2AC --> 0x324
sh_size: 0x78
sh_link: 0x4
sh_info: 0x0
sh_addralign: 0x4
sh_entsize: 0x8
Index: 8
----------Section Data----------
[Elf32_Dyn]
d_tag: 0x4 --> DT_HASH
d_ptr: 0x80480E8
[Elf32_Dyn]
d_tag: 0x5 --> DT_STRTAB
d_ptr: 0x80481EC
[Elf32_Dyn]
d_tag: 0x6 --> DT_SYMTAB
d_ptr: 0x804812C
[Elf32_Dyn]
d_tag: 0xA --> DT_STRSZ
d_val: 0x3E
[Elf32_Dyn]
d_tag: 0xB --> DT_SYMENT
d_val: 0x10
[Elf32_Dyn]
d_tag: 0x15 --> DT_DEBUG
d_ptr: 0x0
[Elf32_Dyn]
d_tag: 0x11 --> DT_REL
d_ptr: 0x804822C
[Elf32_Dyn]
d_tag: 0x12 --> DT_RELSZ
d_val: 0x8
[Elf32_Dyn]
d_tag: 0x13 --> DT_RELENT
d_val: 0x8
[Elf32_Dyn]
d_tag: 0x0
[Elf32_Dyn]
d_tag: 0x0
[Elf32_Dyn]
d_tag: 0x0
[Elf32_Dyn]
d_tag: 0x0
[Elf32_Dyn]
d_tag: 0x0
[Elf32_Dyn]
d_tag: 0x0
[Elf32_Shdr]
sh_name: 0x3D --> .got
sh_type: 0x1 --> SHT_PROGBITS
sh_flags: 0x3 --> SHF_WRITE|SHF_ALLOC
sh_addr: 0x8049324
sh_offset: 0x324 --> 0x328
sh_size: 0x4
sh_link: 0x0
sh_info: 0x0
sh_addralign: 0x4
sh_entsize: 0x4
Index: 9
----------Section Data----------
34 93 04 08
[Elf32_Shdr]
sh_name: 0x55 --> .got.plt
sh_type: 0x1 --> SHT_PROGBITS
sh_flags: 0x3 --> SHF_WRITE|SHF_ALLOC
sh_addr: 0x8049328
sh_offset: 0x328 --> 0x334
sh_size: 0xC
sh_link: 0x0
sh_info: 0x0
sh_addralign: 0x4
sh_entsize: 0x4
Index: 10
----------Section Data----------
ac 92 04 08 00 00 00 00 00 00 00 00
[Elf32_Shdr]
sh_name: 0x5E --> .data
sh_type: 0x1 --> SHT_PROGBITS
sh_flags: 0x3 --> SHF_WRITE|SHF_ALLOC
sh_addr: 0x8049334
sh_offset: 0x334 --> 0x334
sh_size: 0x0
sh_link: 0x0
sh_info: 0x0
sh_addralign: 0x4
sh_entsize: 0x0
Index: 11
----------Section Data----------
[Elf32_Shdr]
sh_name: 0x64 --> .bss
sh_type: 0x8 --> SHT_NOBITS
sh_flags: 0x3 --> SHF_WRITE|SHF_ALLOC
sh_addr: 0x8049334
sh_offset: 0x334 --> 0x338
sh_size: 0x4
sh_link: 0x0
sh_info: 0x0
sh_addralign: 0x4
sh_entsize: 0x0
Index: 12
----------Section Data----------
[Elf32_Shdr]
sh_name: 0x6D --> .stab
sh_type: 0x1 --> SHT_PROGBITS
sh_flags: 0x0 -->
sh_addr: 0x0
sh_offset: 0x334 --> 0x5EC
sh_size: 0x2B8
sh_link: 0xF
sh_info: 0x0
sh_addralign: 0x4
sh_entsize: 0xC
Index: 13
----------Section Data----------
[Elf32_Stab]
n_strx: 0x1
n_type: 0x0
n_other: 0x0
n_desc: 0x39
n_value: 0x4C9
[Elf32_Stab]
n_strx: 0x14
n_type: 0x64
n_other: 0x0
n_desc: 0x2
n_value: 0x8048238
[Elf32_Stab]
n_strx: 0x30
n_type: 0x64
n_other: 0x0
n_desc: 0x2
n_value: 0x8048238
[Elf32_Stab]
n_strx: 0x69
n_type: 0x3C
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x78
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0xA2
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0xBC
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0xEB
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x116
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x146
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x197
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x1DC
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x207
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x236
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x260
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x289
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x2A3
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x2BE
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x2DF
n_type: 0x80
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x2F3
n_type: 0x82
n_other: 0x0
n_desc: 0x0
n_value: 0x489D
[Elf32_Stab]
n_strx: 0x338
n_type: 0x80
n_other: 0x0
n_desc: 0x11
n_value: 0x0
[Elf32_Stab]
n_strx: 0x34D
n_type: 0x80
n_other: 0x0
n_desc: 0x12
n_value: 0x0
[Elf32_Stab]
n_strx: 0x35F
n_type: 0x80
n_other: 0x0
n_desc: 0x13
n_value: 0x0
[Elf32_Stab]
n_strx: 0x372
n_type: 0x80
n_other: 0x0
n_desc: 0x14
n_value: 0x0
[Elf32_Stab]
n_strx: 0x383
n_type: 0x80
n_other: 0x0
n_desc: 0x15
n_value: 0x0
[Elf32_Stab]
n_strx: 0x395
n_type: 0x80
n_other: 0x0
n_desc: 0x16
n_value: 0x0
[Elf32_Stab]
n_strx: 0x3A9
n_type: 0x80
n_other: 0x0
n_desc: 0x17
n_value: 0x0
[Elf32_Stab]
n_strx: 0x3BB
n_type: 0x80
n_other: 0x0
n_desc: 0x18
n_value: 0x0
[Elf32_Stab]
n_strx: 0x3CE
n_type: 0x80
n_other: 0x0
n_desc: 0x19
n_value: 0x0
[Elf32_Stab]
n_strx: 0x3E1
n_type: 0x80
n_other: 0x0
n_desc: 0x1A
n_value: 0x0
[Elf32_Stab]
n_strx: 0x3F6
n_type: 0x80
n_other: 0x0
n_desc: 0x1B
n_value: 0x0
[Elf32_Stab]
n_strx: 0x40C
n_type: 0x80
n_other: 0x0
n_desc: 0x1C
n_value: 0x0
[Elf32_Stab]
n_strx: 0x420
n_type: 0x80
n_other: 0x0
n_desc: 0x1D
n_value: 0x0
[Elf32_Stab]
n_strx: 0x434
n_type: 0x80
n_other: 0x0
n_desc: 0x1E
n_value: 0x0
[Elf32_Stab]
n_strx: 0x446
n_type: 0x80
n_other: 0x0
n_desc: 0x1F
n_value: 0x0
[Elf32_Stab]
n_strx: 0x463
n_type: 0x80
n_other: 0x0
n_desc: 0x20
n_value: 0x0
[Elf32_Stab]
n_strx: 0x47B
n_type: 0x80
n_other: 0x0
n_desc: 0x21
n_value: 0x0
[Elf32_Stab]
n_strx: 0x0
n_type: 0xA2
n_other: 0x0
n_desc: 0x0
n_value: 0x0
[Elf32_Stab]
n_strx: 0x491
n_type: 0x24
n_other: 0x0
n_desc: 0x15
n_value: 0x8048238
[Elf32_Stab]
n_strx: 0x49D
n_type: 0xA0
n_other: 0x0
n_desc: 0x14
n_value: 0x8
[Elf32_Stab]
n_strx: 0x0
n_type: 0x2E
n_other: 0x0
n_desc: 0x0
n_value: 0x8048238
[Elf32_Stab]
n_strx: 0x0
n_type: 0x44
n_other: 0x0
n_desc: 0x15
n_value: 0x0
[Elf32_Stab]
n_strx: 0x0
n_type: 0x44
n_other: 0x0
n_desc: 0x16
n_value: 0x3
[Elf32_Stab]
n_strx: 0x0
n_type: 0x44
n_other: 0x0
n_desc: 0x17
n_value: 0xA
[Elf32_Stab]
n_strx: 0x0
n_type: 0x24
n_other: 0x0
n_desc: 0x0
n_value: 0xC
[Elf32_Stab]
n_strx: 0x0
n_type: 0x4E
n_other: 0x0
n_desc: 0x0
n_value: 0x8048244
[Elf32_Stab]
n_strx: 0x4A7
n_type: 0x24
n_other: 0x0
n_desc: 0x1B
n_value: 0x8048244
[Elf32_Stab]
n_strx: 0x0
n_type: 0x2E
n_other: 0x0
n_desc: 0x0
n_value: 0x8048244
[Elf32_Stab]
n_strx: 0x0
n_type: 0x44
n_other: 0x0
n_desc: 0x1B
n_value: 0x0
[Elf32_Stab]
n_strx: 0x0
n_type: 0x44
n_other: 0x0
n_desc: 0x1C
n_value: 0x13
[Elf32_Stab]
n_strx: 0x0
n_type: 0x44
n_other: 0x0
n_desc: 0x1D
n_value: 0x1F
[Elf32_Stab]
n_strx: 0x0
n_type: 0x44
n_other: 0x0
n_desc: 0x1E
n_value: 0x32
[Elf32_Stab]
n_strx: 0x0
n_type: 0x44
n_other: 0x0
n_desc: 0x1F
n_value: 0x50
[Elf32_Stab]
n_strx: 0x0
n_type: 0x44
n_other: 0x0
n_desc: 0x20
n_value: 0x63
[Elf32_Stab]
n_strx: 0x0
n_type: 0x24
n_other: 0x0
n_desc: 0x0
n_value: 0x68
[Elf32_Stab]
n_strx: 0x0
n_type: 0x4E
n_other: 0x0
n_desc: 0x0
n_value: 0x80482AC
[Elf32_Stab]
n_strx: 0x4C0
n_type: 0x20
n_other: 0x0
n_desc: 0x12
n_value: 0x0
[Elf32_Stab]
n_strx: 0x0
n_type: 0x64
n_other: 0x0
n_desc: 0x0
n_value: 0x80482AC
[Elf32_Shdr]
sh_name: 0x73 --> .stabstr
sh_type: 0x3 --> SHT_STRTAB
sh_flags: 0x0 -->
sh_addr: 0x0
sh_offset: 0x5EC --> 0xAB5
sh_size: 0x4C9
sh_link: 0x0
sh_info: 0x0
sh_addralign: 0x1
sh_entsize: 0x0
Index: 15
----------Section Data----------
NewProgramCyclic.c
C:\AsBuild\AS3.0.0\bin_deb/
C:/projects/TestIP/Logical/NewProgram/NewProgramCyclic.c
gcc2_compiled.
int:t(0,1)=r(0,1);-2147483648;2147483647;
char:t(0,2)=r(0,2);0;127;
long int:t(0,3)=r(0,3);-2147483648;2147483647;
unsigned int:t(0,4)=r(0,4);0;037777777777;
long unsigned int:t(0,5)=r(0,5);0;037777777777;
long long int:t(0,6)=@s64;r(0,6);01000000000000000000000;0777777777777777777777;
long long unsigned int:t(0,7)=@s64;r(0,7);0;01777777777777777777777;
short int:t(0,8)=@s16;r(0,8);-32768;32767;
short unsigned int:t(0,9)=@s16;r(0,9);0;65535;
signed char:t(0,10)=@s8;r(0,10);-128;127;
unsigned char:t(0,11)=@s8;r(0,11);0;255;
float:t(0,12)=r(0,1);4;0;
double:t(0,13)=r(0,1);8;0;
long double:t(0,14)=r(0,1);12;0;
void:t(0,15)=(0,15)
C:/AsBuild/AS3.0.0/AS/GnuInst/V4.1.1/i386-elf/include/bur/plctypes.h
plcbit:t(1,1)=(0,11)
BOOL:t(1,2)=(1,1)
SINT:t(1,3)=(0,10)
INT:t(1,4)=(0,8)
DINT:t(1,5)=(0,3)
USINT:t(1,6)=(0,11)
UINT:t(1,7)=(0,9)
UDINT:t(1,8)=(0,5)
REAL:t(1,9)=(0,12)
LREAL:t(1,10)=(0,13)
plctime:t(1,11)=(0,5)
TIME:t(1,12)=(1,11)
plcdt:t(1,13)=(0,5)
DT:t(1,14)=(1,13)
DATE_AND_TIME:t(1,15)=(1,13)
plcstring:t(1,16)=(0,2)
STRING:t(1,17)=(1,16)
ifun:F(0,1)
ai:p(0,1)
NewProgramCyclic:F(0,15)
i:G(0,1)
[Elf32_Shdr]
sh_name: 0x7C --> .comment
sh_type: 0x1 --> SHT_PROGBITS
sh_flags: 0x0 -->
sh_addr: 0x0
sh_offset: 0xAB5 --> 0xAC7
sh_size: 0x12
sh_link: 0x0
sh_info: 0x0
sh_addralign: 0x1
sh_entsize: 0x0
Index: 16
----------Section Data----------
00 47 43 43 3a 20 28 47 4e 55 29 20 34 2e 31 2e
31 00
[Elf32_Shdr]
sh_name: 0x85 --> .plc
sh_type: 0x1 --> SHT_PROGBITS
sh_flags: 0x0 -->
sh_addr: 0x0
sh_offset: 0xAC7 --> 0xCB5
sh_size: 0x1EE
sh_link: 0x0
sh_info: 0x0
sh_addralign: 0x1
sh_entsize: 0x0
Index: 17
----------Section Data----------
69 65 63 66 69 6c 65 20 22 6c 6f 67 69 63 61 6c
2f 6c 69 62 72 61 72 69 65 73 2f 72 75 6e 74 69
6d 65 2f 72 75 6e 74 69 6d 65 2e 74 79 70 22 20
73 63 6f 70 65 20 22 67 6c 6f 62 61 6c 22 0a 69
65 63 66 69 6c 65 20 22 6c 6f 67 69 63 61 6c 2f
6c 69 62 72 61 72 69 65 73 2f 63 6f 6e 76 65 72
74 2f 63 6f 6e 76 65 72 74 2e 66 75 6e 22 20 73
63 6f 70 65 20 22 67 6c 6f 62 61 6c 22 0a 69 65
63 66 69 6c 65 20 22 6c 6f 67 69 63 61 6c 2f 6c
69 62 72 61 72 69 65 73 2f 72 75 6e 74 69 6d 65
2f 72 75 6e 74 69 6d 65 2e 66 75 6e 22 20 73 63
6f 70 65 20 22 67 6c 6f 62 61 6c 22 0a 69 65 63
66 69 6c 65 20 22 6c 6f 67 69 63 61 6c 2f 6c 69
62 72 61 72 69 65 73 2f 6f 70 65 72 61 74 6f 72
2f 6f 70 65 72 61 74 6f 72 2e 66 75 6e 22 20 73
63 6f 70 65 20 22 67 6c 6f 62 61 6c 22 0a 69 65
63 66 69 6c 65 20 22 6c 6f 67 69 63 61 6c 2f 67
6c 6f 62 61 6c 2e 74 79 70 22 20 73 63 6f 70 65
20 22 67 6c 6f 62 61 6c 22 0a 69 65 63 66 69 6c
65 20 22 6c 6f 67 69 63 61 6c 2f 67 6c 6f 62 61
6c 2e 76 61 72 22 20 73 63 6f 70 65 20 22 67 6c
6f 62 61 6c 22 0a 69 65 63 66 69 6c 65 20 22 6c
6f 67 69 63 61 6c 2f 6e 65 77 70 72 6f 67 72 61
6d 2f 6e 65 77 70 72 6f 67 72 61 6d 2e 74 79 70
22 20 73 63 6f 70 65 20 22 67 6c 6f 62 61 6c 22
0a 69 65 63 66 69 6c 65 20 22 6c 6f 67 69 63 61
6c 2f 6e 65 77 70 72 6f 67 72 61 6d 2f 6e 65 77
70 72 6f 67 72 61 6d 2e 76 61 72 22 20 73 63 6f
70 65 20 22 6c 6f 63 61 6c 22 0a 70 6c 63 65 6e
74 72 79 5f 63 79 63 6c 69 63 20 27 4e 65 77 50
72 6f 67 72 61 6d 43 79 63 6c 69 63 27 0a
[Elf32_Shdr]
sh_name: 0x11 --> .shstrtab
sh_type: 0x3 --> SHT_STRTAB
sh_flags: 0x0 -->
sh_addr: 0x0
sh_offset: 0xCB5 --> 0xD3F
sh_size: 0x8A
sh_link: 0x0
sh_info: 0x0
sh_addralign: 0x1
sh_entsize: 0x0
Index: 18
----------Section Data----------
.symtab
.strtab
.shstrtab
.interp
.hash
.dynsym
.dynstr
.rel.got
.rel.text
.dynamic
.got.plt
.data
.bss
.rel.stab
.stabstr
.comment
.plc
[Elf32_Shdr]
sh_name: 0x42 --> .rel.text
sh_type: 0x9 --> SHT_REL
sh_flags: 0x0 -->
sh_addr: 0x0
sh_offset: 0x1088 --> 0x10D0
sh_size: 0x48
sh_link: 0x13
sh_info: 0x6
sh_addralign: 0x4
sh_entsize: 0x8
Index: 7
----------Section Data----------
[Elf32_Rel]
r_offset: 0x8048253
r_info: 0x1E0A --> ELF32_R_SYM:0x1E, ELF32_R_TYPE:0xA(R_386_GOTPC)
[Elf32_Rel]
r_offset: 0x8048259
r_info: 0x1903 --> ELF32_R_SYM:0x19, ELF32_R_TYPE:0x3(R_386_GOT32)
[Elf32_Rel]
r_offset: 0x8048265
r_info: 0x1903 --> ELF32_R_SYM:0x19, ELF32_R_TYPE:0x3(R_386_GOT32)
[Elf32_Rel]
r_offset: 0x8048270
r_info: 0x1903 --> ELF32_R_SYM:0x19, ELF32_R_TYPE:0x3(R_386_GOT32)
[Elf32_Rel]
r_offset: 0x8048278
r_info: 0x1903 --> ELF32_R_SYM:0x19, ELF32_R_TYPE:0x3(R_386_GOT32)
[Elf32_Rel]
r_offset: 0x8048283
r_info: 0x2004 --> ELF32_R_SYM:0x20, ELF32_R_TYPE:0x4(R_386_PLT32)
[Elf32_Rel]
r_offset: 0x804828E
r_info: 0x1903 --> ELF32_R_SYM:0x19, ELF32_R_TYPE:0x3(R_386_GOT32)
[Elf32_Rel]
r_offset: 0x8048296
r_info: 0x1903 --> ELF32_R_SYM:0x19, ELF32_R_TYPE:0x3(R_386_GOT32)
[Elf32_Rel]
r_offset: 0x80482A1
r_info: 0x1903 --> ELF32_R_SYM:0x19, ELF32_R_TYPE:0x3(R_386_GOT32)
[Elf32_Shdr]
sh_name: 0x69 --> .rel.stab
sh_type: 0x9 --> SHT_REL
sh_flags: 0x0 -->
sh_addr: 0x0
sh_offset: 0x10D0 --> 0x1118
sh_size: 0x48
sh_link: 0x13
sh_info: 0xD
sh_addralign: 0x4
sh_entsize: 0x8
Index: 14
----------Section Data----------
[Elf32_Rel]
r_offset: 0x14
r_info: 0x601 --> ELF32_R_SYM:0x6, ELF32_R_TYPE:0x1(R_386_32)
[Elf32_Rel]
r_offset: 0x20
r_info: 0x601 --> ELF32_R_SYM:0x6, ELF32_R_TYPE:0x1(R_386_32)
[Elf32_Rel]
r_offset: 0x1D0
r_info: 0x2001 --> ELF32_R_SYM:0x20, ELF32_R_TYPE:0x1(R_386_32)
[Elf32_Rel]
r_offset: 0x1E8
r_info: 0x601 --> ELF32_R_SYM:0x6, ELF32_R_TYPE:0x1(R_386_32)
[Elf32_Rel]
r_offset: 0x224
r_info: 0x601 --> ELF32_R_SYM:0x6, ELF32_R_TYPE:0x1(R_386_32)
[Elf32_Rel]
r_offset: 0x230
r_info: 0x1801 --> ELF32_R_SYM:0x18, ELF32_R_TYPE:0x1(R_386_32)
[Elf32_Rel]
r_offset: 0x23C
r_info: 0x601 --> ELF32_R_SYM:0x6, ELF32_R_TYPE:0x1(R_386_32)
[Elf32_Rel]
r_offset: 0x29C
r_info: 0x601 --> ELF32_R_SYM:0x6, ELF32_R_TYPE:0x1(R_386_32)
[Elf32_Rel]
r_offset: 0x2B4
r_info: 0x601 --> ELF32_R_SYM:0x6, ELF32_R_TYPE:0x1(R_386_32)
[Elf32_Shdr]
sh_name: 0x1 --> .symtab
sh_type: 0x2 --> SHT_SYMTAB
sh_flags: 0x0 -->
sh_addr: 0x0
sh_offset: 0x1118 --> 0x1328
sh_size: 0x210
sh_link: 0x14
sh_info: 0x16
sh_addralign: 0x4
sh_entsize: 0x10
Index: 19
----------Section Data----------
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x0
st_size: 0x0
st_info: 0x0 --> STB_LOCAL, STT_NOTYPE
st_other: 0x0
st_shndx: 0x0
IndexInTable: 0x0
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x80480D4
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x1
IndexInTable: 0x1
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x80480E8
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x2
IndexInTable: 0x2
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x804812C
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x3
IndexInTable: 0x3
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x80481EC
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x4
IndexInTable: 0x4
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x804822C
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x5
IndexInTable: 0x5
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x8048234
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x6
IndexInTable: 0x6
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x0
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x7
IndexInTable: 0x7
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x80492AC
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x8
IndexInTable: 0x8
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x8049324
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x9
IndexInTable: 0x9
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x8049328
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0xA
IndexInTable: 0xA
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x8049334
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0xB
IndexInTable: 0xB
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x8049334
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0xC
IndexInTable: 0xC
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x0
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0xD
IndexInTable: 0xD
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x0
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0xE
IndexInTable: 0xE
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x0
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0xF
IndexInTable: 0xF
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x0
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x10
IndexInTable: 0x10
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x0
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x11
IndexInTable: 0x11
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x0
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x12
IndexInTable: 0x12
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x0
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x13
IndexInTable: 0x13
[Elf32_Sym]
st_name: 0x0 -->
st_value: 0x0
st_size: 0x0
st_info: 0x3 --> STB_LOCAL, STT_SECTION
st_other: 0x0
st_shndx: 0x14
IndexInTable: 0x14
[Elf32_Sym]
st_name: 0x1 --> NewProgramCyclic.c
st_value: 0x0
st_size: 0x0
st_info: 0x4 --> STB_LOCAL, STT_FILE
st_other: 0x0
st_shndx: 0xFFF1
IndexInTable: 0x15
[Elf32_Sym]
st_name: 0x14 --> LOADERSTART
st_value: 0x8048234
st_size: 0x4
st_info: 0x11 --> STB_GLOBAL, STT_OBJECT
st_other: 0x0
st_shndx: 0xFFF1
IndexInTable: 0x16
[Elf32_Sym]
st_name: 0x20 --> _DYNAMIC
st_value: 0x80492AC
st_size: 0x0
st_info: 0x11 --> STB_GLOBAL, STT_OBJECT
st_other: 0x0
st_shndx: 0x8
IndexInTable: 0x17
[Elf32_Sym]
st_name: 0x29 --> NewProgramCyclic
st_value: 0x8048244
st_size: 0x68
st_info: 0x12 --> STB_GLOBAL, STT_FUNC
st_other: 0x0
st_shndx: 0x6
IndexInTable: 0x18
[Elf32_Sym]
st_name: 0x3A --> i
st_value: 0x8049334
st_size: 0x4
st_info: 0x11 --> STB_GLOBAL, STT_OBJECT
st_other: 0x0
st_shndx: 0xC
IndexInTable: 0x19
[Elf32_Sym]
st_name: 0x3C --> EXEOFFSET
st_value: 0x8048238
st_size: 0x0
st_info: 0x10 --> STB_GLOBAL, STT_NOTYPE
st_other: 0x0
st_shndx: 0x6
IndexInTable: 0x1A
[Elf32_Sym]
st_name: 0x46 --> __bss_start
st_value: 0x8049334
st_size: 0x0
st_info: 0x10 --> STB_GLOBAL, STT_NOTYPE
st_other: 0x0
st_shndx: 0xFFF1
IndexInTable: 0x1B
[Elf32_Sym]
st_name: 0x52 --> PLCVARIABLES
st_value: 0x8049338
st_size: 0x0
st_info: 0x10 --> STB_GLOBAL, STT_NOTYPE
st_other: 0x0
st_shndx: 0xFFF1
IndexInTable: 0x1C
[Elf32_Sym]
st_name: 0x5F --> _edata
st_value: 0x8049334
st_size: 0x0
st_info: 0x10 --> STB_GLOBAL, STT_NOTYPE
st_other: 0x0
st_shndx: 0xFFF1
IndexInTable: 0x1D
[Elf32_Sym]
st_name: 0x66 --> _GLOBAL_OFFSET_TABLE_
st_value: 0x8049328
st_size: 0x0
st_info: 0x11 --> STB_GLOBAL, STT_OBJECT
st_other: 0x2
st_shndx: 0xA
IndexInTable: 0x1E
[Elf32_Sym]
st_name: 0x7C --> _end
st_value: 0x8049338
st_size: 0x0
st_info: 0x10 --> STB_GLOBAL, STT_NOTYPE
st_other: 0x0
st_shndx: 0xFFF1
IndexInTable: 0x1F
[Elf32_Sym]
st_name: 0x81 --> ifun
st_value: 0x8048238
st_size: 0xC
st_info: 0x12 --> STB_GLOBAL, STT_FUNC
st_other: 0x0
st_shndx: 0x6
IndexInTable: 0x20
[Elf32_Shdr]
sh_name: 0x9 --> .strtab
sh_type: 0x3 --> SHT_STRTAB
sh_flags: 0x0 -->
sh_addr: 0x0
sh_offset: 0x1328 --> 0x13AE
sh_size: 0x86
sh_link: 0x0
sh_info: 0x0
sh_addralign: 0x1
sh_entsize: 0x0
Index: 20
----------Section Data----------
NewProgramCyclic.c
LOADERSTART
_DYNAMIC
NewProgramCyclic
i
EXEOFFSET
__bss_start
PLCVARIABLES
_edata
_GLOBAL_OFFSET_TABLE_
_end
ifun
----------Program Headers----------
[Elf32_Phdr]
p_type: 0x6 --> PT_PHDR
p_offset: 0x34
p_vaddr: 0x8048034
p_paddr: 0x8048034
p_filesz: 0xA0
p_memsz: 0xA0
p_flags: 0x5
p_align: 0x4
[Elf32_Phdr]
p_type: 0x3 --> PT_INTERP
p_offset: 0xD4
p_vaddr: 0x80480D4
p_paddr: 0x80480D4
p_filesz: 0x13
p_memsz: 0x13
p_flags: 0x4
p_align: 0x1
[Elf32_Phdr]
p_type: 0x1 --> PT_LOAD
p_offset: 0x0
p_vaddr: 0x8048000
p_paddr: 0x8048000
p_filesz: 0x2AC
p_memsz: 0x2AC
p_flags: 0x5
p_align: 0x1000
[Elf32_Phdr]
p_type: 0x1 --> PT_LOAD
p_offset: 0x2AC
p_vaddr: 0x80492AC
p_paddr: 0x80492AC
p_filesz: 0x88
p_memsz: 0x8C
p_flags: 0x6
p_align: 0x1000
[Elf32_Phdr]
p_type: 0x2 --> PT_DYNAMIC
p_offset: 0x2AC
p_vaddr: 0x80492AC
p_paddr: 0x80492AC
p_filesz: 0x78
p_memsz: 0x78
p_flags: 0x6
p_align: 0x4
[-- Attachment #3: NewProgram.out --]
[-- Type: application/octet-stream, Size: 5038 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: relocations when doing file command at gdb prompt
2007-03-08 15:49 ` Roland Puntaier
@ 2007-03-08 16:05 ` Daniel Jacobowitz
2007-03-08 17:54 ` Antwort: " Roland Puntaier
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2007-03-08 16:05 UTC (permalink / raw)
To: Roland Puntaier; +Cc: gdb
On Thu, Mar 08, 2007 at 04:49:06PM +0100, Roland Puntaier wrote:
> > So, are you loading an object file or a linked program?
> An object file.
Actually, ET_DYN is not quite either. It's more like a linked program
for the purpose of my question.
> > Does it have relocations included?
> Yes
> [Elf32_Stab]
> n_strx: 0x14
> n_type: 0x64
> n_other: 0x0
> n_desc: 0x2
> n_value: 0x8048238
> [Elf32_Rel]
> r_offset: 0x14
> r_info: 0x601 --> ELF32_R_SYM:0x6, ELF32_R_TYPE:0x1(R_386_32)
So, it's relocated already, but the relocations are still present.
No wonder GDB is doubling them.
This code was originally added for shared libraries (ET_DYN). Those
generated by the GNU binutils at the time had relocations in shared
libraries that had _not_ been applied.
I don't see how we can sensibly distinguish the two cases. What
toolchain produced this file?
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 7+ messages in thread
* Antwort: Re: relocations when doing file command at gdb prompt
2007-03-08 16:05 ` Daniel Jacobowitz
@ 2007-03-08 17:54 ` Roland Puntaier
2007-03-08 18:26 ` Daniel Jacobowitz
2007-03-08 22:24 ` Daniel Jacobowitz
0 siblings, 2 replies; 7+ messages in thread
From: Roland Puntaier @ 2007-03-08 17:54 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb
> Actually, ET_DYN is not quite either. It's more like a linked program
> for the purpose of my question.
Yes. Actually only the .plt .text and .data section find their way to the
target device.
> So, it's relocated already, but the relocations are still present.
> No wonder GDB is doubling them.
> ...
> I don't see how we can sensibly distinguish the two cases. What
> toolchain produced this file?
GCC, but with -Wl,-q,-shared,-T,"YYY.x", i.e shared and with modified
linker script, and the relocation info is kept because of a
post-processing using it.
This means there is no way to avoid the doubling and still keep the .rel
sections without changing GDB code, doesn't it?
Interesting that even
(gdb)add-symbol-file NewProgram.out 0 -s data 0
(gdb)info line 29
yields a wrong address.
In objfiles.c/objfile_relocate/(line 552) l->item[i].pc based on 0 would
be very fine, because ANOFFSET (objfile->section_offsets, i) (line 529)
turns out to be 0.
Strange that these two don't fit together.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Antwort: Re: relocations when doing file command at gdb prompt
2007-03-08 17:54 ` Antwort: " Roland Puntaier
@ 2007-03-08 18:26 ` Daniel Jacobowitz
2007-03-08 22:24 ` Daniel Jacobowitz
1 sibling, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2007-03-08 18:26 UTC (permalink / raw)
To: Roland Puntaier; +Cc: gdb
On Thu, Mar 08, 2007 at 06:54:16PM +0100, Roland Puntaier wrote:
> > So, it's relocated already, but the relocations are still present.
> > No wonder GDB is doubling them.
> > ...
> > I don't see how we can sensibly distinguish the two cases. What
> > toolchain produced this file?
> GCC, but with -Wl,-q,-shared,-T,"YYY.x", i.e shared and with modified
> linker script, and the relocation info is kept because of a
> post-processing using it.
Yes, I've seen this technique before. We need to find something to do
about it. It may mean dropping support for the old form, where shared
libraries needed the relocations, and applying them only for ET_REL
objects.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Antwort: Re: relocations when doing file command at gdb prompt
2007-03-08 17:54 ` Antwort: " Roland Puntaier
2007-03-08 18:26 ` Daniel Jacobowitz
@ 2007-03-08 22:24 ` Daniel Jacobowitz
1 sibling, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2007-03-08 22:24 UTC (permalink / raw)
To: Roland Puntaier; +Cc: gdb
On Thu, Mar 08, 2007 at 06:54:16PM +0100, Roland Puntaier wrote:
> This means there is no way to avoid the doubling and still keep the .rel
> sections without changing GDB code, doesn't it?
Yes. You could remove just the relocations for the debug sections,
but that's silly. If you add this to the top of
symfile_relocate_debug_section, it should fix the problem.
+ if (bfd_get_file_flags (abfd) & (EXEC_P | DYNAMIC))
+ return NULL;
GNU binutils doesn't create shared libraries that need relocations
applied any more. In fact, it hasn't for a while. Maybe we should
remove support for those quirky objects, since the --emit-relocs
variant seems more common and more useful.
Does anyone have an opinion?
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-03-08 22:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-07 16:16 relocations when doing file command at gdb prompt Roland Puntaier
2007-03-08 15:22 ` Daniel Jacobowitz
2007-03-08 15:49 ` Roland Puntaier
2007-03-08 16:05 ` Daniel Jacobowitz
2007-03-08 17:54 ` Antwort: " Roland Puntaier
2007-03-08 18:26 ` Daniel Jacobowitz
2007-03-08 22:24 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox