Bug 2995 - objcopy and strip of finally linked executables fails
Summary: objcopy and strip of finally linked executables fails
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.17
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-03 13:02 UTC by Rainer Emrich
Modified: 2008-05-28 20:50 UTC (History)
3 users (show)

See Also:
Host: hppa64-hp-hpux11.00
Target: hppa64-hp-hpux11.00
Build: hppa64-hp-hpux11.00
Last reconfirmed:


Attachments
The executable for the empty program. (22.64 KB, application/octet-stream)
2006-08-03 13:05 UTC, Rainer Emrich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Emrich 2006-08-03 13:02:27 UTC
given the minimal C program main.c:

int main()
{
}

$ gcc -c -o main.o main.c
$ objcopy  main.o test.o
$ nm test.o 
0000000000000000 T main
$ strip test.o
$ nm test.o
nm: test.o: no symbols
$ gcc -o main main.o
$ objcopy main test
BFD: sta03759: section .data lma 0x8000000100000000 overlaps previous sections
BFD: sta03759: section .ctors lma 0x8000000100000148 overlaps previous sections
BFD: sta03759: section .dtors lma 0x8000000100000158 overlaps previous sections
BFD: sta03759: section .init lma 0x8000000100000168 overlaps previous sections
BFD: sta03759: section .init_array lma 0x8000000100000178 overlaps previous sections
BFD: sta03759: section .fini lma 0x8000000100000188 overlaps previous sections
BFD: sta03759: section .fini_array lma 0x8000000100000190 overlaps previous sections
BFD: sta03759: section .eh_frame lma 0x8000000100000198 overlaps previous sections
BFD: sta03759: section .jcr lma 0x80000001000003d0 overlaps previous sections
BFD: sta03759: section .data.rel.local lma 0x80000001000003d8 overlaps previous
sections
BFD: sta03759: section .data.rel.ro lma 0x80000001000003e0 overlaps previous
sections
BFD: sta03759: section .plt lma 0x8000000100000400 overlaps previous sections
BFD: sta03759: section .dlt lma 0x8000000100000430 overlaps previous sections
BFD: sta03759: section .sdata lma 0x80000001000005b8 overlaps previous sections
BFD: sta03759: warning: allocated section `$UNWIND$' not in segment
BFD: sta03759: warning: allocated section `$UNWIND$MILLICODE$' not in segment
BFD: sta03759: warning: allocated section `.PARISC.pfa_counter' not in segment
BFD: sta03759: warning: allocated section `.PARISC.global' not in segment
BFD: sta03759: warning: allocated section `.HP.init' not in segment
BFD: sta03759: warning: allocated section `.preinit' not in segment
BFD: sta03759: warning: allocated section `.sbss' not in segment
BFD: sta03759: warning: allocated section `.hbss' not in segment
BFD: sta03759: warning: allocated section `.tbss' not in segment
objcopy: sta03759: File too large
objcopy: sta03759: File too large
$
$
$ strip main
BFD: sta07628: section .data lma 0x8000000100000000 overlaps previous sections
BFD: sta07628: section .ctors lma 0x8000000100000148 overlaps previous sections
BFD: sta07628: section .dtors lma 0x8000000100000158 overlaps previous sections
BFD: sta07628: section .init lma 0x8000000100000168 overlaps previous sections
BFD: sta07628: section .init_array lma 0x8000000100000178 overlaps previous sections
BFD: sta07628: section .fini lma 0x8000000100000188 overlaps previous sections
BFD: sta07628: section .fini_array lma 0x8000000100000190 overlaps previous sections
BFD: sta07628: section .eh_frame lma 0x8000000100000198 overlaps previous sections
BFD: sta07628: section .jcr lma 0x80000001000003d0 overlaps previous sections
BFD: sta07628: section .data.rel.local lma 0x80000001000003d8 overlaps previous
sections
BFD: sta07628: section .data.rel.ro lma 0x80000001000003e0 overlaps previous
sections
BFD: sta07628: section .plt lma 0x8000000100000400 overlaps previous sections
BFD: sta07628: section .dlt lma 0x8000000100000430 overlaps previous sections
BFD: sta07628: section .sdata lma 0x80000001000005b8 overlaps previous sections
BFD: sta07628: warning: allocated section `$UNWIND$' not in segment
BFD: sta07628: warning: allocated section `$UNWIND$MILLICODE$' not in segment
BFD: sta07628: warning: allocated section `.PARISC.pfa_counter' not in segment
BFD: sta07628: warning: allocated section `.PARISC.global' not in segment
BFD: sta07628: warning: allocated section `.HP.init' not in segment
BFD: sta07628: warning: allocated section `.preinit' not in segment
BFD: sta07628: warning: allocated section `.sbss' not in segment
BFD: sta07628: warning: allocated section `.hbss' not in segment
BFD: sta07628: warning: allocated section `.tbss' not in segment
strip: sta07628: File too large
strip: sta07628: File too large
$
$
$


The binutils testsuite shows two similiar failures:
FAIL: simple objcopy of executable
FAIL: run objcopy of executable

The binutils.log contains:
Executing on host: gcc  -c  -o testglue.o
/appl/shared/gnu/HP-UX/hppa64-hp-hpux11.00/share/dejagnu/testglue.c    (timeout
= 300)
/appl/shared/gnu/HP-UX/hppa64-hp-hpux11.00/share/dejagnu/testglue.c: In function
'__wrap_abort':
/appl/shared/gnu/HP-UX/hppa64-hp-hpux11.00/share/dejagnu/testglue.c:126:
warning: incompatible implicit declaration of built-in function 'abort'
/appl/shared/gnu/HP-UX/hppa64-hp-hpux11.00/share/dejagnu/testglue.c: In function
'__wrap_main':
/appl/shared/gnu/HP-UX/hppa64-hp-hpux11.00/share/dejagnu/testglue.c:142:
warning: incompatible implicit declaration of built-in function 'exit'
output is:
/appl/shared/gnu/HP-UX/hppa64-hp-hpux11.00/share/dejagnu/testglue.c: In function
'__wrap_abort':
/appl/shared/gnu/HP-UX/hppa64-hp-hpux11.00/share/dejagnu/testglue.c:126:
warning: incompatible implicit declaration of built-in function 'abort'
/appl/shared/gnu/HP-UX/hppa64-hp-hpux11.00/share/dejagnu/testglue.c: In function
'__wrap_main':
/appl/shared/gnu/HP-UX/hppa64-hp-hpux11.00/share/dejagnu/testglue.c:142:
warning: incompatible implicit declaration of built-in function 'exit'

Executing on host: gcc
/raid/tecosim/it/devel/projects/develtools/src/binutils-2.17/binutils/testsuite/binutils-all/testprog.c
  -g  -lm   -o tmpdir/testprog    (timeout =
 300)
Setting LD_LIBRARY_PATH to
:/appl/shared/gcc/HP-UX/hppa64-hp-hpux11.00/gcc-4.1.1/lib:/appl/shared/gnu/HP-UX/hppa64-hp-hpux11.00/lib:
ok
/disk1/SCRATCH/tmp/binutils/binutils/objcopy  tmpdir/testprog tmpdir/copyprog
Executing on host: /disk1/SCRATCH/tmp/binutils/binutils/objcopy  tmpdir/testprog
tmpdir/copyprog   (timeout = 300)
BFD: tmpdir/copyprog: section .data lma 0x8000000100000000 overlaps previous
sections
BFD: tmpdir/copyprog: section .ctors lma 0x8000000100000158 overlaps previous
sections
BFD: tmpdir/copyprog: section .dtors lma 0x8000000100000168 overlaps previous
sections
BFD: tmpdir/copyprog: section .init lma 0x8000000100000178 overlaps previous
sections
BFD: tmpdir/copyprog: section .init_array lma 0x8000000100000188 overlaps
previous sections
BFD: tmpdir/copyprog: section .fini lma 0x8000000100000198 overlaps previous
sections
BFD: tmpdir/copyprog: section .fini_array lma 0x80000001000001a0 overlaps
previous sections
BFD: tmpdir/copyprog: section .eh_frame lma 0x80000001000001a8 overlaps previous
sections
BFD: tmpdir/copyprog: section .jcr lma 0x80000001000003e0 overlaps previous sections
BFD: tmpdir/copyprog: section .data.rel.local lma 0x80000001000003e8 overlaps
previous sections
BFD: tmpdir/copyprog: section .data.rel.ro lma 0x80000001000003f0 overlaps
previous sections
BFD: tmpdir/copyprog: section .plt lma 0x8000000100000410 overlaps previous sections
BFD: tmpdir/copyprog: section .dlt lma 0x8000000100000460 overlaps previous sections
BFD: tmpdir/copyprog: section .sdata lma 0x8000000100000620 overlaps previous
sections
BFD: tmpdir/copyprog: warning: allocated section `$UNWIND$' not in segment
BFD: tmpdir/copyprog: warning: allocated section `$UNWIND$MILLICODE$' not in segment
BFD: tmpdir/copyprog: warning: allocated section `.PARISC.pfa_counter' not in
segment
BFD: tmpdir/copyprog: warning: allocated section `.PARISC.global' not in segment
BFD: tmpdir/copyprog: warning: allocated section `.HP.init' not in segment
BFD: tmpdir/copyprog: warning: allocated section `.preinit' not in segment
BFD: tmpdir/copyprog: warning: allocated section `.hbss' not in segment
BFD: tmpdir/copyprog: warning: allocated section `.tbss' not in segment
/disk1/SCRATCH/tmp/binutils/binutils/objcopy: tmpdir/copyprog: File too large
/disk1/SCRATCH/tmp/binutils/binutils/objcopy: tmpdir/copyprog: File too large
BFD: tmpdir/copyprog: section .data lma 0x8000000100000000 overlaps previous
sections
BFD: tmpdir/copyprog: section .ctors lma 0x8000000100000158 overlaps previous
sections
BFD: tmpdir/copyprog: section .dtors lma 0x8000000100000168 overlaps previous
sections
BFD: tmpdir/copyprog: section .init lma 0x8000000100000178 overlaps previous
sections
BFD: tmpdir/copyprog: section .init_array lma 0x8000000100000188 overlaps
previous sections
BFD: tmpdir/copyprog: section .fini lma 0x8000000100000198 overlaps previous
sections
BFD: tmpdir/copyprog: section .fini_array lma 0x80000001000001a0 overlaps
previous sections
BFD: tmpdir/copyprog: section .eh_frame lma 0x80000001000001a8 overlaps previous
sections
BFD: tmpdir/copyprog: section .jcr lma 0x80000001000003e0 overlaps previous sections
BFD: tmpdir/copyprog: section .data.rel.local lma 0x80000001000003e8 overlaps
previous sections
BFD: tmpdir/copyprog: section .data.rel.ro lma 0x80000001000003f0 overlaps
previous sections
BFD: tmpdir/copyprog: section .plt lma 0x8000000100000410 overlaps previous sections
BFD: tmpdir/copyprog: section .dlt lma 0x8000000100000460 overlaps previous sections
BFD: tmpdir/copyprog: section .sdata lma 0x8000000100000620 overlaps previous
sections
BFD: tmpdir/copyprog: warning: allocated section `$UNWIND$' not in segment
BFD: tmpdir/copyprog: warning: allocated section `$UNWIND$MILLICODE$' not in segment
BFD: tmpdir/copyprog: warning: allocated section `.PARISC.pfa_counter' not in
segment
BFD: tmpdir/copyprog: warning: allocated section `.PARISC.global' not in segment
BFD: tmpdir/copyprog: warning: allocated section `.HP.init' not in segment
BFD: tmpdir/copyprog: warning: allocated section `.preinit' not in segment
BFD: tmpdir/copyprog: warning: allocated section `.hbss' not in segment
BFD: tmpdir/copyprog: warning: allocated section `.tbss' not in segment
/disk1/SCRATCH/tmp/binutils/binutils/objcopy: tmpdir/copyprog: File too large
/disk1/SCRATCH/tmp/binutils/binutils/objcopy: tmpdir/copyprog: File too large

FAIL: simple objcopy of executable
FAIL: run objcopy of executable



A testcase for stripping executables is not provided as AFAIS. I checked the
binutils.log
So I think it's a good idea to add one.

Rainer
Comment 1 Rainer Emrich 2006-08-03 13:05:58 UTC
Created attachment 1193 [details]
The executable for the empty program.

Build with gcc-4.1.1 binutils-2.17
Comment 2 Rainer Emrich 2006-08-03 13:31:22 UTC
(In reply to comment #1)
> Created an attachment (id=1193)
> The executable for the empty program.
> 
> Build with gcc-4.1.1 binutils-2.17

Forgot an important information:
I'm using gcc with HP-UX linker
92453-07 linker command s800.sgs ld PA64 B.11.43 REL 050124
ld: 92453-07 linker linker ld B.11.43 050125