[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#469517: -fstack-protector produces segfaulting binaries on arm/armel



reassign 469517 gcc-4.3
thanks

-snip-
#include <stdio.h>

main()
{
        printf ("Hello World!\n");
}
-snip-
$ gcc -save-temps -fstack-protector -fPIE hello.c -o hello
$ ./hello
$ Hello World!
$ gcc -save-temps -fstack-protector-all -fPIE helloall.c -o helloall
$ ./helloall
$ Segmentation fault

helloall.s segfaults, hello.s runs fine. if -fstack-protector isn't to
be supported on arm, it gcc should ignore the option like done on
mips/mipsel.

Using built-in specs.
Target: arm-linux-gnueabi
Configured with: ../src/configure linux gnueabi
Thread model: posix
gcc version 4.3.1 20080401 (prerelease) (Debian 4.3.0-3)


	.cpu arm9tdmi
	.fpu softvfp
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 6
	.eabi_attribute 18, 4
	.file	"hello.c"
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Hello World!\000"
	.text
	.align	2
	.global	main
	.type	main, %function
main:
	@ Function supports interworking.
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	mov	ip, sp
	stmfd	sp!, {fp, ip, lr, pc}
	sub	fp, ip, #4
	sub	sp, sp, #8
	ldr	r3, .L3
.LPIC0:
	add	r3, pc, r3
	ldr	r2, .L3+4
	add	r3, r3, r2
	mov	r0, r3
	bl	puts(PLT)
	sub	sp, fp, #12
	ldmfd	sp, {fp, sp, lr}
	bx	lr
.L4:
	.align	2
.L3:
	.word	_GLOBAL_OFFSET_TABLE_-(.LPIC0+8)
	.word	.LC0(GOTOFF)
	.size	main, .-main
	.ident	"GCC: (Debian 4.3.0-3) 4.3.1 20080401 (prerelease)"
	.section	.note.GNU-stack,"",%progbits
	.cpu arm9tdmi
	.fpu softvfp
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 6
	.eabi_attribute 18, 4
	.file	"helloall.c"
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Hello World!\000"
	.text
	.align	2
	.global	main
	.type	main, %function
main:
	@ Function supports interworking.
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	mov	ip, sp
	stmfd	sp!, {r4, fp, ip, lr, pc}
	sub	fp, ip, #4
	sub	sp, sp, #20
	ldr	r4, .L4
.LPIC0:
	add	r4, pc, r4
	ldr	r3, .L4+4
	ldr	r2, [fp, #-36]
	ldr	r3, [r2, r3]
	ldr	r3, [r3, #0]
	str	r3, [fp, #-24]
	ldr	r3, .L4+8
	add	r3, r4, r3
	mov	r0, r3
	bl	puts(PLT)
	ldr	r3, .L4+4
	ldr	r3, [r4, r3]
	ldr	r2, [fp, #-24]
	ldr	r3, [r3, #0]
	cmp	r2, r3
	beq	.L3
	bl	__stack_chk_fail(PLT)
.L3:
	sub	sp, fp, #16
	ldmfd	sp, {r4, fp, sp, lr}
	bx	lr
.L5:
	.align	2
.L4:
	.word	_GLOBAL_OFFSET_TABLE_-(.LPIC0+8)
	.word	__stack_chk_guard(GOT)
	.word	.LC0(GOTOFF)
	.size	main, .-main
	.ident	"GCC: (Debian 4.3.0-3) 4.3.1 20080401 (prerelease)"
	.section	.note.GNU-stack,"",%progbits

Reply to: