This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ARM] Align _start constant pool to 4 bytes


This patch fixes a failure seen in libnih on natty, which compiles
libc as Thumb-2.  Scrt1.o can be assembled as Thumb-2:

#if defined(__thumb2__)
	.thumb
	.syntax unified
#endif

and has an explicit constant pool:

.L_GOT:
	.word _GLOBAL_OFFSET_TABLE_ - .L_GOT
	.word __libc_csu_fini(GOT)
	.word __libc_csu_init(GOT)
	.word main(GOT)

However, .word does not impose 4 byte aligment on ARM, and the code
has no explicit .align directive.

The pool is correctly aligned with respect to the start of the section,
but the lack of an explicit alignment requirement means that the section
itself remains only 2-byte aligned.  _start can then be linked at a
misaligned address.

I looked for other uses of .word and other uses of .thumb*.  This seems
to be the only affected file.

Tested on arm-linux-gnueabi.  Please install if OK.

Richard


2011-06-30  Richard Sandiford  <richard.sandiford@linaro.org>

	* sysdeps/arm/elf/start.S (_start): Align the constant pool to 4 bytes.

Index: sysdeps/arm/elf/start.S
===================================================================
--- sysdeps/arm/elf/start.S	2011-04-28 14:17:43.000000000 +0100
+++ sysdeps/arm/elf/start.S	2011-06-30 12:16:21.000000000 +0100
@@ -134,6 +134,7 @@ _start:
 	bl abort
 
 #ifdef SHARED
+	.align 2
 .L_GOT:
 	.word _GLOBAL_OFFSET_TABLE_ - .L_GOT
 	.word __libc_csu_fini(GOT)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]