This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix .note.GNU-stack in libgcc.a
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 5 Jun 2003 21:51:55 +0200
- Subject: [PATCH] Fix .note.GNU-stack in libgcc.a
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
I've missed libgcc.a .note.GNU-stack perms which were all set to need
executable stack while none of them obviously need it.
The problem is that they are ld -r'ed together with a small assembly stub,
which did not have .note.GNU-stack section.
Fixed thusly, ok to commit?
2003-06-05 Jakub Jelinek <jakub@redhat.com>
* mklibgcc.in: Propagate .note.GNU-stack section if needed into
the .hidden assembly stubs.
--- gcc/mklibgcc.in.jj 2003-05-16 05:54:56.000000000 -0400
+++ gcc/mklibgcc.in 2003-06-05 15:41:14.000000000 -0400
@@ -339,11 +339,15 @@ EOF
if [ "@libgcc_visibility@" = yes -a "$SHLIB_LINK" ]; then
libgcc_a_objs=
echo ""
+ echo "libgcc/${dir}/stacknote.s: stmp-dirs"
+ echo ' echo | $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) '${flags}' -S -o - -xc - | grep .note.GNU-stack > $@.tmp'
+ echo ' mv $@.tmp $@'
+ echo ""
for o in $libgcc_objs $libgcc_st_objs; do
# .oS objects will have all non-local symbol definitions .hidden
oS=`echo ${o} | sed s~${objext}'$~.oS~g'`
- echo "${oS}: stmp-dirs ${o}"
- echo ' $(NM_FOR_TARGET) '${SHLIB_NM_FLAGS} ${o}' | $(AWK) '\''NF == 3 { print "\t.hidden", $$3 }'\'' | $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) '${flags}' -r -nostdinc -nostdlib -o $@ '${o}' -xassembler -'
+ echo "${oS}: stmp-dirs libgcc/${dir}/stacknote.s ${o}"
+ echo ' ( $(NM_FOR_TARGET) '${SHLIB_NM_FLAGS} ${o}' | $(AWK) '\''NF == 3 { print "\t.hidden", $$3 }'\''; cat libgcc/${dir}/stacknote.s ) | $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) '${flags}' -r -nostdinc -nostdlib -o $@ '${o}' -xassembler -'
libgcc_a_objs="${libgcc_a_objs} ${oS}"
done
fi
@@ -430,6 +434,7 @@ echo ' if [ -d $(stage)/$$dir ]; then
echo ' done'
echo ' -for dir in '"${dirs}"'; do \'
echo ' mv $$dir/*'"${objext}"' $(stage)/$$dir; \'
+echo ' test ! -f $$dir/stacknote.s || mv $$dir/stacknote.s $(stage)/$$dir; \'
echo ' test ! -f $$dir/libgcc.a || mv $$dir/lib* $(stage)/$$dir; \'
echo ' done'
Jakub