From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3635 invoked by alias); 11 Apr 2006 13:33:26 -0000 Received: (qmail 3626 invoked by uid 22791); 11 Apr 2006 13:33:25 -0000 X-Spam-Check-By: sourceware.org Received: from smtp18.wanadoo.fr (HELO smtp18.wanadoo.fr) (193.252.22.126) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 11 Apr 2006 13:33:22 +0000 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf1804.wanadoo.fr (SMTP Server) with ESMTP id B75617000097 for ; Tue, 11 Apr 2006 15:33:19 +0200 (CEST) Received: from w98.wanadoo.fr (AMarseille-252-1-93-225.w86-202.abo.wanadoo.fr [86.202.148.225]) by mwinf1804.wanadoo.fr (SMTP Server) with ESMTP id 5469C700008B; Tue, 11 Apr 2006 15:33:18 +0200 (CEST) X-ME-UUID: 20060411133318345.5469C700008B@mwinf1804.wanadoo.fr Message-Id: <6.1.0.6.0.20060411152707.00acc440@pop.wanadoo.fr> X-Sender: jr.peulve@pop.wanadoo.fr Date: Tue, 11 Apr 2006 13:45:00 -0000 To: Daniel Jacobowitz From: Jean-Rene Peulve Subject: Re: Wrong address for static function in linux module Cc: gdb@sources.redhat.com In-Reply-To: <20060411131142.GA21521@nevyn.them.org> References: <6.1.0.6.0.20060411102654.00ad0710@pop.wanadoo.fr> <20060411131142.GA21521@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; format=flowed Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00130.txt.bz2 Hi Daniel, See below. Jean-Rene Peulv=E9 At 15:11 11/04/06, Daniel Jacobowitz wrote: >On Tue, Apr 11, 2006 at 11:01:13AM +0200, Jean-Rene Peulve wrote: > > Hi, > > I am debugging a linux module on a Coldfire and I encounter the followi= ng > > problem: > > -functions which have the static attribut are always relocated at offs= et 0 > > of the .text section with the break command when the display command = at > > the > > right address disassemble the right static function. > >This is normally supposed to be handled in >symfile_relocate_debug_section. Are the bad functions really in >".text", or in another named text section? Both functions horloge_read and HorlogeCheck are in the .text section. > Does the debug section >have proper relocations for that .debug_info entry (readelf -r)? Here the output of m68k-elf-readelf -s horloge.o (using binutils-2.16.1): I am not familiar with the following output. static functions does not show up in this list. Relocation section '.rela.text' at offset 0x20060 contains 59 entries: Offset Info Type Sym.Value Sym. Name + Addend 00000006 00000401 R_68K_32 00000000 .bss + 8 0000000c 00001e01 R_68K_32 00000000 jiffies + 0 00000012 00000301 R_68K_32 00000000 .data + 14 0000001a 00000201 R_68K_32 00000000 .text + 32 00000020 00000401 R_68K_32 00000000 .bss + 10 0000002a 00001f01 R_68K_32 00000000 add_timer + 0 00000038 00000301 R_68K_32 00000000 .data + 18 0000003e 00000301 R_68K_32 00000000 .data + 18 0000005c 00001c01 R_68K_32 00000008 horlogeWq + 0 00000062 00002001 R_68K_32 00000000 __wake_up + 0 00000068 00000201 R_68K_32 00000000 .text + 0 0000007e 00002101 R_68K_32 00000000 kmalloc + 0 00000096 00000301 R_68K_32 00000000 .data + 18 0000009c 00000301 R_68K_32 00000000 .data + 18 000000a4 00000301 R_68K_32 00000000 .data + 18 000000b0 00000301 R_68K_32 00000000 .data + 18 000000ba 00000301 R_68K_32 00000000 .data + 18 000000c4 00000301 R_68K_32 00000000 .data + 14 000000f2 00002201 R_68K_32 00000000 kfree + 0 000000f8 00000301 R_68K_32 00000000 .data + 18 00000100 00000301 R_68K_32 00000000 .data + 18 00000110 00000301 R_68K_32 00000000 .data + 18 00000116 00000301 R_68K_32 00000000 .data + 18 0000011e 00000401 R_68K_32 00000000 .bss + 0 00000124 00002301 R_68K_32 00000000 del_timer + 0 0000014c 00001c01 R_68K_32 00000008 horlogeWq + 0 00000152 00002401 R_68K_32 00000000 interruptible_sleep_on + 0 00000188 00001c01 R_68K_32 00000008 horlogeWq + 0 0000019c 00002501 R_68K_32 00000000 __pollwait + 0 000001c6 00000301 R_68K_32 00000000 .data + 14 000001f2 00002601 R_68K_32 00000000 _ramend + 0 000001fc 00002701 R_68K_32 00000000 is_in_rom + 0 0000020a 00002701 R_68K_32 00000000 is_in_rom + 0 00000224 00000501 R_68K_32 00000000 .rodata + 5 0000022a 00002801 R_68K_32 00000000 printk + 0 0000023e 00002601 R_68K_32 00000000 _ramend + 0 00000248 00002701 R_68K_32 00000000 is_in_rom + 0 00000256 00002701 R_68K_32 00000000 is_in_rom + 0 00000270 00000501 R_68K_32 00000000 .rodata + 2b 00000276 00002801 R_68K_32 00000000 printk + 0 000002a0 00002901 R_68K_32 00000000 memcpy + 0 000002bc 00000501 R_68K_32 00000000 .rodata + 52 000002c2 00002801 R_68K_32 00000000 printk + 0 000002d6 00000301 R_68K_32 00000000 .data + 14 000002e8 00000301 R_68K_32 00000000 .data + 14 000002fc 00002901 R_68K_32 00000000 memcpy + 0 00000306 00000301 R_68K_32 00000000 .data + 14 0000030e 00000401 R_68K_32 00000000 .bss + 0 00000314 00002301 R_68K_32 00000000 del_timer + 0 0000031a 00000201 R_68K_32 00000000 .text + 0 00000330 00000301 R_68K_32 00000000 .data + 20 00000336 00000501 R_68K_32 00000000 .rodata + 66 00000340 00002a01 R_68K_32 00000000 register_chrdev + 0 00000346 00000401 R_68K_32 00000000 .bss + 4 0000034c 00000401 R_68K_32 00000000 .bss + 0 0000035c 00000501 R_68K_32 00000000 .rodata + 66 00000366 00002b01 R_68K_32 00000000 unregister_chrdev + 0 0000036c 00000401 R_68K_32 00000000 .bss + 0 00000372 00002301 R_68K_32 00000000 del_timer + 0 Relocation section '.rela.data' at offset 0x20324 contains 10 entries: Offset Info Type Sym.Value Sym. Name + Addend 0000000c 00001c01 R_68K_32 00000008 horlogeWq + 4 00000010 00001c01 R_68K_32 00000008 horlogeWq + 4 00000018 00000301 R_68K_32 00000000 .data + 18 0000001c 00000301 R_68K_32 00000000 .data + 18 00000020 00001d01 R_68K_32 00000000 __this_module + 0 00000028 00000201 R_68K_32 00000000 .text + 136 00000034 00000201 R_68K_32 00000000 .text + 174 00000038 00000201 R_68K_32 00000000 .text + 1b4 00000040 00000201 R_68K_32 00000000 .text + 70 00000048 00000201 R_68K_32 00000000 .text + ce Relocation section '.rela.stab' at offset 0x2039c contains 41 entries: Offset Info Type Sym.Value Sym. Name + Addend 00000014 00000201 R_68K_32 00000000 .text + 0 00000020 00000201 R_68K_32 00000000 .text + 0 00002b40 00000601 R_68K_32 00000000 .modinfo + 0 00002c48 00000601 R_68K_32 00000000 .modinfo + 78 00002c60 00000301 R_68K_32 00000000 .data + 14 00002c6c 00000301 R_68K_32 00000000 .data + 18 00002c78 00000301 R_68K_32 00000000 .data + 20 00002c84 00000201 R_68K_32 00000000 .text + 0 00002cd8 00000201 R_68K_32 00000000 .text + 32 00002d14 00000201 R_68K_32 00000000 .text + 3c 00002d2c 00000201 R_68K_32 00000000 .text + 3c 00002d74 00000201 R_68K_32 00000000 .text + 4e 00002d8c 00000201 R_68K_32 00000000 .text + 4e 00002e40 00000201 R_68K_32 00000000 .text + 70 00002eac 00000201 R_68K_32 00000000 .text + 94 00002f48 00000201 R_68K_32 00000000 .text + be 00003044 00000201 R_68K_32 00000000 .text + ce 0000308c 00000201 R_68K_32 00000000 .text + de 000030ec 00000201 R_68K_32 00000000 .text + ea 0000311c 00000201 R_68K_32 00000000 .text + fc 00003134 00000201 R_68K_32 00000000 .text + fe 00003158 00000201 R_68K_32 00000000 .text + 10a 00003170 00000201 R_68K_32 00000000 .text + 10a 00003188 00000201 R_68K_32 00000000 .text + 10e 000031ac 00000201 R_68K_32 00000000 .text + 10e 000032e4 00000201 R_68K_32 00000000 .text + 136 000033f8 00000201 R_68K_32 00000000 .text + 174 00003434 00000201 R_68K_32 00000000 .text + 186 0000347c 00000201 R_68K_32 00000000 .text + 1a0 00003524 00000201 R_68K_32 00000000 .text + 1b4 000035b4 00000201 R_68K_32 00000000 .text + 1ea 00003620 00000201 R_68K_32 00000000 .text + 21e 0000365c 00000201 R_68K_32 00000000 .text + 236 000036c8 00000201 R_68K_32 00000000 .text + 26a 00003968 00000201 R_68K_32 00000000 .text + 32a 00003998 00000201 R_68K_32 00000000 .text + 344 000039c8 00000201 R_68K_32 00000000 .text + 350 00003a28 00000201 R_68K_32 00000000 .text + 356 00003a94 00002e01 R_68K_32 0000037a HorlogeCheck + 0 00003ac4 00000401 R_68K_32 00000000 .bss + 0 00003ad0 00000201 R_68K_32 00000000 .text + 382 Output of m68k-elf-readelf -s horloge.o: Symbol table '.symtab' contains 47 entries: .. 12: 00000136 62 FUNC LOCAL DEFAULT 1 horloge_read .. 46: 0000037a 8 FUNC GLOBAL DEFAULT 1 HorlogeCheck More details from maint print commands. from the output of maint print symbols symbols.txt int horloge_read(struct file *, char *, size_t, loff_t *); block object 0x83a54f0, 0x790060..0x79009e section .text block #006, object at 0x83a54f0 under 0x83bdc54, 8 syms/buckets in 0x790060..0x79009e, function horloge_read, compiled with gcc2 from the output of maint print psymbols psymbols.txt `horloge_read', function, 0x790196 from the output of maint print msymbols msymbols.txt [ 9] t 0x790196 horloge_read section .text gdb302bdi> x/i 0x791196 0x791196 : linkw %fp,#0 Remark: the line number 503 is wrong as well ! gdb302bdi> x/i horloge_read 0x791060 : linkw %fp,#0 >-- >Daniel Jacobowitz >CodeSourcery