On Fri, Mar 20, 2009 at 4:16 AM, Jim Van Vorst
<jvanvorst@xxxxxxxxx> wrote:
When generating an executable with
microblaze-uclinux-gcc, it sets the permissions of the output file as 740
(user rwx, group r) whereas my native gcc sets it to 770, which is what I
want. Anyone know how to change
this?
Looks like the linker (or more likely, the elf2flt post link
processing) is the culprit:
$ gcc -c -o hello-host.o hello.c
$ gcc -o
hello-host hello.c
$ ls -al hello-host*
-rwxrwxr-x 1 jwilliams
jwilliams 4721 Mar 20 12:08 hello-host
-rw-rw-r-- 1 jwilliams jwilliams
864 Mar 20 12:08 hello-host.o
So my native GCC (gcc 4.1.2 on CentOS 5)
creates objfile with perms 664, executable with 775
Same, but with
microblaze-uclinux-gcc:
$ microblaze-uclinux-gcc -c -o hello-target.o
hello.c
$ microblaze-uclinux-gcc -o hello-target hello.c
$ ls -al
hello-target*
-rwxr--r-- 1 jwilliams jwilliams 29764 Mar 20 12:12
hello-target
-rwxrwxr-x 1 jwilliams jwilliams 62046 Mar 20 12:12
hello-target.gdb
-rw-rw-r-- 1 jwilliams jwilliams 696 Mar 20
12:10 hello-target.o
So the .o has the same perms 664, but the executable
is 744 (which is a bit wierd)
What's your umask? Mine is
$
umask
0002
A quick fix is to hack the microblaze-uclinux-ld and ld
scripts to chmod as required. Note ld is a script in uclinux toolchain
that then calls real linker renamed as ld.real
Index:
tools/linux-i386/microblaze-uclinux-tools/microblaze-uclinux/bin/ld
===================================================================
---
tools/linux-i386/microblaze-uclinux-tools/microblaze-uclinux/bin/ld
(revision 5150)
+++
tools/linux-i386/microblaze-uclinux-tools/microblaze-uclinux/bin/ld
(working copy)
@@ -161,6 +161,7
@@
fi
rm -f "$OFILE.elf" # not needed for any
reason
rm -f
"$NEWLDSCRIPT"
+
chmod 775
"$OFILE"
exit 0
fi
You also
want to apply the same change to microblaze-linux-ld in
tools/linux-i386/microblaze-uclinux-tools/bin/microblaze-uclinux-ld
Can
you find any info on default perms on gcc/ld outputs? Clearly the flat
binaries should follow the same
rules.
Regards,
John
--