This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch]: Discard some sections for pe and pep


Kai Tietz wrote:

> I noticed that in objcopy there is some issue about long section names.
> The option --add-gnu-debuglink seems to be broken as it shortens
> automatically the section name to 8 characters, Dave rings here a
> bell? Can be related to the way I initial did the split
> 
>        objcopy --only-keep-debug $f ${strippath}/$d/$s.dbg
>         objcopy --strip-debug $f
>         objcopy --add-gnu-debuglink=${strippath}/$d/$s.dbg $f
> 
> $f = is the executable with debug information
> $s = is the base name of executable
> 
> Is by this something wrong? But well, this is a different issue.

  Your formula looks right to me, and I can't reproduce the problem:

> admin@ubik /tmp/debuglink
> $ ls
> hw.c
> 
> admin@ubik /tmp/debuglink
> $ cat hw.c
> 
> #include <stdio.h>
> #include <stdlib.h>
> 
> int main (int argc, const char **argv)
> {
>   printf ("hello world\n");
>   return argc;
> }
> 
> void *_Znwj (unsigned int foo)
> {
>   return malloc (foo);
> }
> admin@ubik /tmp/debuglink
> $ rm -rf /tmp/debuglink2/dbg
> 
> admin@ubik /tmp/debuglink
> $ gcc -g hw.c  -o hw.exe
> 
> admin@ubik /tmp/debuglink
> $ mkdir -p /tmp/debuglink2/dbg
> 
> admin@ubik /tmp/debuglink
> $ strippath=/tmp/debuglink2
> 
> admin@ubik /tmp/debuglink
> $ f=hw.exe
> 
> admin@ubik /tmp/debuglink
> $ d=dbg
> 
> admin@ubik /tmp/debuglink
> $ s=hw
> 
> admin@ubik /tmp/debuglink
> $ /gnu/binutils/obj2/binutils/objcopy.exe --only-keep-debug $f ${strippath}/$d/
> $s.dbg
> 
> admin@ubik /tmp/debuglink
> $ /gnu/binutils/obj2/binutils/objcopy.exe --strip-debug $f
> 
> admin@ubik /tmp/debuglink
> $ /gnu/binutils/obj2/binutils/objcopy.exe --add-gnu-debuglink=${strippath}/$d/$
> s.dbg $f
> 
> admin@ubik /tmp/debuglink
> $ objdump -h $f ${strippath}/$d/$s.dbg
> 
> hw.exe:     file format pei-i386
> 
> Sections:
> Idx Name          Size      VMA       LMA       File off  Algn
>   0 .text         00000cd8  00401000  00401000  00000400  2**4
>                   CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA
>   1 .data         000001a8  00402000  00402000  00001200  2**5
>                   CONTENTS, ALLOC, LOAD, DATA
>   2 .eh_frame     00000004  00403000  00403000  00001400  2**2
>                   CONTENTS, ALLOC, LOAD, DATA
>   3 .bss          00000138  00404000  00404000  00000000  2**3
>                   ALLOC
>   4 .idata        00000338  00405000  00405000  00001600  2**2
>                   CONTENTS, ALLOC, LOAD, DATA
>   5 .gnu_debuglink 0000000c  00406000  00406000  00001a00  2**2
>                   CONTENTS, READONLY
> 
> /tmp/debuglink2/dbg/hw.dbg:     file format pei-i386
> 
> Sections:
> Idx Name          Size      VMA       LMA       File off  Algn
>   0 .text         00000cd8  00401000  00401000  00000000  2**4
>                   ALLOC, LOAD, READONLY, CODE, DATA
>   1 .data         000001a8  00402000  00402000  00000000  2**5
>                   ALLOC, LOAD, DATA
>   2 .eh_frame     00000004  00403000  00403000  00000000  2**2
>                   ALLOC, LOAD, DATA
>   3 .bss          00000138  00404000  00404000  00000000  2**3
>                   ALLOC
>   4 .idata        00000338  00405000  00405000  00000000  2**2
>                   ALLOC, LOAD, DATA
>   5 .debug_aranges 00000180  00406000  00406000  000003a8  2**0
>                   CONTENTS, READONLY, DEBUGGING
>   6 .debug_pubnames 0000027f  00407000  00407000  000005a8  2**0
>                   CONTENTS, READONLY, DEBUGGING
>   7 .debug_info   00005383  00408000  00408000  000009a8  2**0
>                   CONTENTS, READONLY, DEBUGGING
>   8 .debug_abbrev 00000b92  0040e000  0040e000  00005da8  2**0
>                   CONTENTS, READONLY, DEBUGGING
>   9 .debug_line   00000aaf  0040f000  0040f000  000069a8  2**0
>                   CONTENTS, READONLY, DEBUGGING
>  10 .debug_frame  000002c4  00410000  00410000  000075a8  2**2
>                   CONTENTS, READONLY, DEBUGGING
>  11 .debug_str    00000145  00411000  00411000  000079a8  2**0
>                   CONTENTS, READONLY, DEBUGGING
>  12 .debug_loc    0000085e  00412000  00412000  00007ba8  2**0
>                   CONTENTS, READONLY, DEBUGGING
>  13 .debug_ranges 00000048  00413000  00413000  000085a8  2**0
>                   CONTENTS, READONLY, DEBUGGING
> 
> admin@ubik /tmp/debuglink
> $

  This is with binutils from latest CVS.  What might we be doing differently?

    cheers,
      DaveK


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]