[PATCH][BZ 18960] setlocale.c: Mark *_used symbols as unaligned.

Marcin Kościelnicki koriakin@0x04.net
Mon Sep 28 15:12:00 GMT 2015


On 28/09/15 17:05, Rich Felker wrote:
> On Mon, Sep 28, 2015 at 04:52:10PM +0200, Florian Weimer wrote:
>> On 09/28/2015 04:18 PM, Rich Felker wrote:
>>
>>> Can you explain how/why you think this is needed? char has no
>>> alignment requirements (inherently) so as far as I can tell, the
>>> compiler may not make any alignment assumptions about an extern object
>>> of type char.
>>
>> s390(x) expects all top-level objects in the data segment to be aligned
>> to at least 2.  As far as I can tell, this is not explicitly mentioned
>> in the psABI supplement, but it is heavily implied by .align directives
>> and use of the lalr instruction.
>
> So reading chars via a pointer or array is slower than reading a
> single non-array char object? Uhg...what an awful ISA. Thanks for the
> explanation, though.
>
> Rich
>

It's not about access speed, it's about loading the address of a symbol. 
  Eg.

extern char x[10];

read x[0]:

larl %r2, x
lg %r2, 0(%r2)

read x[1]:

larl %r2, x
lg %r2, 1(%r2)

If address of x is not aligned to 2 bytes, larl won't work and you have 
to stuff the address into a literal pool and read it from there.



More information about the Libc-alpha mailing list