[Cbe-oss-dev] embedspu and execstack

Kazunori Asayama asayama at sm.sony.co.jp
Fri Oct 3 23:44:25 EST 2008


Alan Modra wrote:
> On Fri, Oct 03, 2008 at 12:03:59AM +0900, Kazunori Asayama wrote:
>> Of course, I can fix this problem by always adding '-Wa,-noexecstack'
>> option to embedspu, however, I feel it's reasonable the embedspu
>> script adds that option implicitly.
> 
> It is reasonable, but only if your compiler generates .GNU-stack
> sections for other object files.
> 

Yes, my gcc (Fedora 10's gcc 4.3.2) generates .note.GNU-stack section:
---
# cat test.c
void f(void) { }
# gcc -c -save-temps test.c
# cat test.s
	.file	"test.c"
	.gnu_attribute 4, 1
	.gnu_attribute 8, 1
	.section	".text"
	.align 2
	.globl f
	.type	f, @function
f:
	stwu 1,-16(1)
	stw 31,12(1)
	mr 31,1
	lwz 11,0(1)
	lwz 31,-4(11)
	mr 1,11
	blr
	.size	f,.-f
	.ident	"GCC: (GNU) 4.3.2 20080905 (Red Hat 4.3.2-3)"
	.section	.note.GNU-stack,"", at progbits
# readelf -S test.o
There are 10 section headers, starting at offset 0xe4:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00000000 000034 00001c 00  AX  0   0  4
  [ 2] .data             PROGBITS        00000000 000050 000000 00  WA  0   0  1
  [ 3] .bss              NOBITS          00000000 000050 000000 00  WA  0   0  1
  [ 4] .comment          PROGBITS        00000000 000050 00002d 00      0   0  1
  [ 5] .note.GNU-stack   PROGBITS        00000000 00007d 000000 00      0   0  1
  [ 6] .gnu.attributes   LOOS+ffffff5    00000000 00007d 000012 00      0   0  1
  [ 7] .shstrtab         STRTAB          00000000 00008f 000055 00      0   0  1
  [ 8] .symtab           SYMTAB          00000000 000274 000090 10      9   8  4
  [ 9] .strtab           STRTAB          00000000 000304 00000a 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)
---

I got the same result from Fedora 9's gcc (gcc 4.3.0).

-- 
(ASAYAMA Kazunori
  (asayama at sm.sony.co.jp))
t



More information about the cbe-oss-dev mailing list