As mentioned on the mailinglist, objcopy does not make an executable of an executable file if it is compiled with -fPIE -pie. Problem confirmed with git as today (GNU objcopy (GNU Binutils) 2.20.51.20091018). And now how to easy reproduce. Notice how for the first round tmp and tmp2 got the same permissions, while when compiled with "-fPIE -pie" they have not: $ echo "main(){}" > tmp.c && gcc -o tmp tmp.c && objcopy tmp tmp2 && ls -l tmp tmp2 -rwxr-xr-x 1 xake xake 8081 17 okt 09.12 tmp -rwxr-xr-x 1 xake xake 8081 17 okt 09.12 tmp2 $ echo "main(){}" > tmp.c && gcc -fPIE -pie -o tmp tmp.c && objcopy tmp tmp2 && ls -l tmp tmp2 -rwxr-xr-x 1 xake xake 8133 17 okt 09.13 tmp -rw-r--r-- 1 xake xake 8133 17 okt 09.13 tmp2
A patch is posted at http://sourceware.org/ml/binutils/2009-10/msg00396.html
(In reply to comment #1) > A patch is posted at > > http://sourceware.org/ml/binutils/2009-10/msg00396.html Works for me.:-)
Subject: Bug 10802 CVSROOT: /cvs/src Module name: src Changes by: amodra@sourceware.org 2009-10-20 00:49:31 Modified files: bfd : ChangeLog opncls.c Log message: PR binutils/10802 * opncls.c (_maybe_make_executable): Make DYNAMIC files executable. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.4818&r2=1.4819 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/opncls.c.diff?cvsroot=src&r1=1.59&r2=1.60
I'll put this on the branch after verifying that testsuite results are not perturbed.
Subject: Bug 10802 CVSROOT: /cvs/src Module name: src Branch: binutils-2_20-branch Changes by: amodra@sourceware.org 2009-10-20 08:40:37 Modified files: bfd : ChangeLog opncls.c Log message: PR binutils/10802 * opncls.c (_maybe_make_executable): Make DYNAMIC files executable. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.4761.2.29&r2=1.4761.2.30 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/opncls.c.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.57.2.2&r2=1.57.2.3