From patchwork Wed Nov 12 15:41:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 3679 Received: (qmail 20030 invoked by alias); 12 Nov 2014 15:42:18 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 20020 invoked by uid 89); 12 Nov 2014 15:42:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: plane.gmane.org To: libc-alpha@sourceware.org From: Stefan Liebler Subject: Re: Misaligned stack on 32-bit s390? Date: Wed, 12 Nov 2014 16:41:58 +0100 Lines: 109 Message-ID: References: <54619F3E.8080306@redhat.com> <5461D6CA.9030902@twiddle.net> <5461DBC4.9090508@redhat.com> <5462231E.3050502@linux.vnet.ibm.com> <5462DB6B.8060405@redhat.com> <20141112070929.GR2086@spoyarek.pnq.redhat.com> <546309D8.9030702@twiddle.net> <20141112081619.GS2086@spoyarek.pnq.redhat.com> Mime-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: <20141112081619.GS2086@spoyarek.pnq.redhat.com> Hi, i have built glibc from scratch with the patch and get the following error while compiling rtld.c: /tmp/cc3Ata9V.s: Assembler messages: /tmp/cc3Ata9V.s:111: Error: symbol `.L3' is already defined /tmp/cc3Ata9V.s:124: Error: symbol `.L4' is already defined The compiler generated these labels in function _dl_initial_error_catch_tsd in order to get the address of the variable data via literal pool and got. A compiler with --with-arch=z9-109 uses larl-instruction to get the address and does not generate these labels. Using numbered labels in the inline-assembly in macro RTLD_START (see patch) avoids the label collision and the glibc build succeeds There is no test-suite regression and the stack is adjusted. The inline-assembly in s390-64/dl-machine.h does not use any label, thus there we need no change. Thanks. Stefan --- 2014-11-12 Stefan Liebler * sysdeps/s390/s390-32/dl-machine.h (RTLD_START): Use numbered labels in inline assembly. diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h index 47f5874..6780405 100644 --- a/sysdeps/s390/s390-32/dl-machine.h +++ b/sysdeps/s390/s390-32/dl-machine.h @@ -148,7 +148,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) .globl _dl_start_user\n\ _start:\n\ basr %r13,0\n\ -.L0: ahi %r13,.Llit-.L0\n\ +0: ahi %r13,.Llit-0b\n\ lr %r2,%r15\n\ # Alloc stack frame\n\ ahi %r15,-96\n\ @@ -168,7 +168,7 @@ _dl_start_user:\n\ l %r1,_dl_skip_args@GOT(%r12)\n\ l %r1,0(%r1) # load _dl_skip_args\n\ ltr %r1,%r1\n\ - je .L4 # Skip the arg adjustment if there were none.\n\ + je 4f # Skip the arg adjustment if there were none.\n\ # Get the original argument count.\n\ l %r0,96(%r15)\n\ # Subtract _dl_skip_args from it.\n\ @@ -183,28 +183,28 @@ _dl_start_user:\n\ sll %r0,2\n # Number of skipped bytes.\n\ ar %r5,%r0 # Source pointer = Dest + Skipped args.\n\ # argv copy loop:\n\ -.L1: l %r7,0(%r5) # Load a word from the source.\n\ +1: l %r7,0(%r5) # Load a word from the source.\n\ st %r7,0(%r6) # Store the word in the destination.\n\ ahi %r5,4\n\ ahi %r6,4\n\ ltr %r7,%r7\n\ - jne .L1 # Stop after copying the NULL.\n\ + jne 1b # Stop after copying the NULL.\n\ # envp copy loop:\n\ -.L2: l %r7,0(%r5) # Load a word from the source.\n\ +2: l %r7,0(%r5) # Load a word from the source.\n\ st %r7,0(%r6) # Store the word in the destination.\n\ ahi %r5,4\n\ ahi %r6,4\n\ ltr %r7,%r7\n\ - jne .L2 # Stop after copying the NULL.\n\ + jne 2b # Stop after copying the NULL.\n\ # Now we have to zero out the envp entries after NULL to allow\n\ # start.S to properly find auxv by skipping zeroes.\n\ # zero out loop:\n\ lhi %r7,0\n\ -.L3: st %r7,0(%r6) # Store zero.\n\ +3: st %r7,0(%r6) # Store zero.\n\ ahi %r6,4 # Advance dest pointer.\n\ ahi %r1,-1 # Subtract one from the word count.\n\ ltr %r1,%r1\n\ - jne .L3 # Keep copying if the word count is non-zero.\n\ + jne 3b # Keep copying if the word count is non-zero.\n\ # Adjust _dl_argv\n\ la %r6,100(%r15)\n\ l %r1,_dl_argv@GOT(%r12)\n\ @@ -216,7 +216,7 @@ _dl_start_user:\n\ # Call the function to run the initializers.\n\ # Load the parameters:\n\ # (%r2, %r3, %r4, %r5) = (_dl_loaded, argc, argv, envp)\n\ -.L4: l %r2,_rtld_local@GOT(%r12)\n\ +4: l %r2,_rtld_local@GOT(%r12)\n\ l %r2,0(%r2)\n\ l %r3,96(%r15)\n\ la %r4,100(%r15)\n\