diff mbox

S/390: Get rid of assembler warning value truncated.

Message ID m4nmhg$r6k$1@ger.gmane.org
State Committed
Headers show

Commit Message

Stefan Liebler Nov. 21, 2014, 3:42 p.m. UTC
Hi Andreas,

On 11/20/2014 05:43 PM, Andreas Schwab wrote:> Stefan Liebler 
<stli@linux.vnet.ibm.com> writes:
 > This is only equivalent if _dl_start - 1b is always negative.
 >
 > Andreas.
 >

Yes you are right. Thanks.
The function elf_machine_load_address (void) is inlined in _dl_start,
thus (_dl_start - 1b) is negative. If it wouldn´t be inlined and would 
be located after elf_machine_load_address, this is not correct.

But truncating the expression (in this case: 0xffffffff7fffffea) by 
anding it with 0x00000000ffffffff, the resulting value isn´t changed 
regardless of (_dl_start - 1b) is positive or negative, but the 
assembler does not warn about truncating the value.

Bye
Stefan

---
2014-11-21  Stefan Liebler  <stli@linux.vnet.ibm.com>

	sysdeps/s390/s390-32/dl-machine.h (elf_machine_load_address):
	Truncating assembler expression to a .long expression.

Comments

Stefan Liebler Nov. 27, 2014, 2:40 p.m. UTC | #1
PING

On 11/21/2014 04:42 PM, Stefan Liebler wrote:
> Hi Andreas,
>
> On 11/20/2014 05:43 PM, Andreas Schwab wrote:> Stefan Liebler
> <stli@linux.vnet.ibm.com> writes:
>  > This is only equivalent if _dl_start - 1b is always negative.
>  >
>  > Andreas.
>  >
>
> Yes you are right. Thanks.
> The function elf_machine_load_address (void) is inlined in _dl_start,
> thus (_dl_start - 1b) is negative. If it wouldn´t be inlined and would
> be located after elf_machine_load_address, this is not correct.
>
> But truncating the expression (in this case: 0xffffffff7fffffea) by
> anding it with 0x00000000ffffffff, the resulting value isn´t changed
> regardless of (_dl_start - 1b) is positive or negative, but the
> assembler does not warn about truncating the value.
>
> Bye
> Stefan
>
> ---
> 2014-11-21  Stefan Liebler  <stli@linux.vnet.ibm.com>
>
>      sysdeps/s390/s390-32/dl-machine.h (elf_machine_load_address):
>      Truncating assembler expression to a .long expression.
diff mbox

Patch

diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h
index 6780405..72fb7fe 100644
--- a/sysdeps/s390/s390-32/dl-machine.h
+++ b/sysdeps/s390/s390-32/dl-machine.h
@@ -72,7 +72,7 @@  elf_machine_load_address (void)
 
   asm( "   bras  1,2f\n"
        "1: .long _GLOBAL_OFFSET_TABLE_ - 1b\n"
-       "   .long _dl_start - 1b - 0x80000000\n"
+       "   .long (_dl_start - 1b - 0x80000000) & 0x00000000ffffffff\n"
        "2: l     %0,4(1)\n"
        "   ar    %0,1\n"
        "   al    1,0(1)\n"