From patchwork Thu May 14 19:12:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 472507 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D4D2114027F for ; Fri, 15 May 2015 05:13:10 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sourceware.org header.i=@sourceware.org header.b=g6ClH3gS; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=XevRBG03DiE8m3fo ufmOESly84IE4PQu2pbiLxrUoDoW90HoV5MbgqvB5THn06KudBe2L0OU8vjQrDIg RIMkq0itoesJuBHwhEF4XLBuwXfTLFIJ2zDwtrQBTKM3i4szfAHo3tg+g2FCIFiu 6g+b+VG9wlKxnEkPa8eFr/UMGy4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; s=default; bh=qyyVqIwkjMO0Mw7Nmj1BBM Ldxh0=; b=g6ClH3gSTplylcZsAvB8LpcdKVxCxXFyzmqhiWMIYnt3KUNnAGAHka nL8KyGRX7OUF8WOA/3A+ayjqxjc/kSWwBdhiV5hnTgcwbwQkYYWT6iip1kMKTqkY w24VGrlT1K4+nIp03HN9w4L4GHHoVnjlebMDPYIbCbRZKeYsE4DvA= Received: (qmail 39679 invoked by alias); 14 May 2015 19:13:01 -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 39646 invoked by uid 89); 14 May 2015 19:13:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qc0-f171.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=VZ5+A+fVDJJca+j/RD/2CBQhWd8Jpli66wxlZpWpnWs=; b=KTm6Nfn/STlWrMLKbYyhtwg65vceI6zcBxFY6jFZ7HcemTJYcm24pko4PlkNiyHs1u KS+RHwvEyJhTQsYhtvrgQHvmqSmUHDlPoW+ljw9amZgcTsJs//kKoJNhek66q0e8nUoL O5dylvpjrSn2bic5imdUuTByodwCsJzGHy8AaoLlT2GNhtemP9F+PJa25GIqlYBshtHR qkragfcSFZvqv9bndaiR3+nYjAlf3DAVw1LGx8caNqGtUn4DZFyh6Ri31Lg3QhwEwY9O ml2rL1E9dDkyoHiTNtm/C32F6kvfq4qeF2yEFqnGPr6Yfvw+BudHrQPg2XTquVCsdcH6 g9mw== X-Gm-Message-State: ALoCoQlru+nmGB2ibjRwvBzm1xnWKKg3ZdQD4OjEBdScy5SvlN6NRvWu0UAuE0kAmX8ix2O3h9em X-Received: by 10.229.252.201 with SMTP id mx9mr7881345qcb.1.1431630776069; Thu, 14 May 2015 12:12:56 -0700 (PDT) Message-ID: <5554F3B4.3050404@linaro.org> Date: Thu, 14 May 2015 16:12:52 -0300 From: Adhemerval Zanella User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: "H.J. Lu" CC: GNU C Library Subject: Re: [committed, PATCH] BZ #18409: Remove a trailing `\' in make-syscalls.sh References: <5553A664.8090904@linaro.org> <5554E36E.3000801@linaro.org> In-Reply-To: On 14-05-2015 15:08, H.J. Lu wrote: > On Thu, May 14, 2015 at 11:03 AM, Adhemerval Zanella > wrote: >> >> >> On 13-05-2015 16:34, H.J. Lu wrote: >>> On Wed, May 13, 2015 at 12:30 PM, Adhemerval Zanella >>> wrote: >>>> Hi >>>> >>>> On 13-05-2015 13:20, H.J. Lu wrote: >>>>> commit c14874927b499ddfdbb03745bb32bfc778b8595f >>>>> Author: Roland McGrath >>>>> Date: Tue May 22 16:00:50 2012 -0700 >>>>> >>>>> syscalls.list support for vDSO IFUNCs, use it for x32 gettimeofday and time. >>>>> >>>>> added >>>>> >>>>> \$(foreach p,\$(sysd-rules-targets),\$(objpfx)\$(patsubst %,\$p,$file).os): \\ >>>>> \$(..)sysdeps/unix/make-syscalls.sh\ >>>>> \$(make-target-directory) >>>>> >>>>> to sysdeps/unix/make-syscalls.sh which generates >>>>> >>>>> #### CALL=gettimeofday NUMBER=(0x40000000 + 96) ARGS=i:pP SOURCE=- >>>>> ifeq (,$(filter gettimeofday,$(unix-syscalls))) >>>>> unix-syscalls += gettimeofday >>>>> $(foreach p,$(sysd-rules-targets),$(foreach >>>>> o,$(object-suffixes-noshared),$(objpfx)$(patsubst >>>>> %,$p,gettimeofday)$o)): \ >>>>> $(..)sysdeps/unix/make-syscalls.sh >>>>> $(make-target-directory) >>>>> (echo '#define SYSCALL_NAME gettimeofday'; \ >>>>> echo '#define SYSCALL_NARGS 2'; \ >>>>> echo '#define SYSCALL_SYMBOL __gettimeofday'; \ >>>>> echo '#include '; \ >>>>> echo 'weak_alias (__gettimeofday, gettimeofday)'; \ >>>>> echo 'libc_hidden_weak (gettimeofday)'; \ >>>>> ) | $(compile-syscall) $(foreach p,$(patsubst >>>>> %gettimeofday,%,$(basename $(@F))),$($(p)CPPFLAGS)) >>>>> $(foreach p,$(sysd-rules-targets),$(objpfx)$(patsubst %,$p,gettimeofday).os): \ >>>>> $(..)sysdeps/unix/make-syscalls.sh $(make-target-directory) >>>>> ^^^^^^^^^ Missing newline >>>>> (echo '#include '; \ >>>>> echo 'extern void *__gettimeofday_ifunc (void) __asm >>>>> ("__gettimeofday");'; \ >>>>> echo 'void *'; \ >>>>> echo '__gettimeofday_ifunc (void)'; \ >>>>> echo '{'; \ >>>>> echo ' PREPARE_VERSION_KNOWN (symver, LINUX_2_6);'; \ >>>>> echo ' return _dl_vdso_vsym ("__vdso_gettimeofday", &symver);'; \ >>>>> echo '}'; \ >>>>> echo 'asm (".type __gettimeofday, %gnu_indirect_function");'; \ >>>>> echo 'asm (".globl __GI___gettimeofday\n"'; \ >>>>> echo ' "__GI___gettimeofday = __gettimeofday");'; \ >>>>> echo 'weak_alias (__gettimeofday, gettimeofday)'; \ >>>>> echo 'libc_hidden_weak (gettimeofday)'; \ >>>>> ) | $(compile-stdin.c) $(foreach p,$(patsubst >>>>> %gettimeofday,%,$(basename $(@F))),$($(p)CPPFLAGS)) >>>>> endif >>>>> >>>>> This only affected x32. I checked in this patch after tested on >>>>> x32. >>>>> >>>>> Adhemerval, can you check if your problem with dash in >>>>> >>>>> https://sourceware.org/ml/libc-alpha/2015-04/msg00277.html >>>>> >>>>> is fixed by this? >>>>> >>>>> Thanks. >>>> >>>> I have been testing another more complete fix pointed out by Joseph [1] >>>> and it fixes the x32 build with dash issue I was seeing. Shouldn't we >>>> push this one? >>>> >>>> [1] https://sourceware.org/ml/libc-alpha/2015-02/msg00396.html >>> >>> Well, this part is the same as the one I checked in: >>> >>> \$(foreach p,\$(sysd-rules-targets),\$(objpfx)\$(patsubst %,\$p,$file).os): \\ >>> - \$(..)sysdeps/unix/make-syscalls.sh\ >>> + \$(..)sysdeps/unix/make-syscalls.sh >>> >>> At minimum, that patch should be rebased. >>> >> >> What about: >> >> diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh >> index 910a22c..12f664e 100644 >> --- a/sysdeps/unix/make-syscalls.sh >> +++ b/sysdeps/unix/make-syscalls.sh >> @@ -272,28 +272,33 @@ while read file srcfile caller syscall args strong weak; do >> vdso_symbol="${vdso_syscall%@*}" >> vdso_symver="${vdso_syscall#*@}" >> vdso_symver=`echo "$vdso_symver" | sed 's/\./_/g'` >> - echo "\ >> + cat <> + >> \$(foreach p,\$(sysd-rules-targets),\$(objpfx)\$(patsubst %,\$p,$file).os): \\ >> \$(..)sysdeps/unix/make-syscalls.sh >> \$(make-target-directory) >> (echo '#include '; \\ >> - echo 'extern void *${strong}_ifunc (void) __asm (\"${strong}\");'; \\ >> + echo 'extern void *${strong}_ifunc (void) __asm ("${strong}");'; \\ >> echo 'void *'; \\ >> echo '${strong}_ifunc (void)'; \\ >> echo '{'; \\ >> echo ' PREPARE_VERSION_KNOWN (symver, ${vdso_symver});'; \\ >> - echo ' return _dl_vdso_vsym (\"${vdso_symbol}\", &symver);'; \\ >> + echo ' return _dl_vdso_vsym ("${vdso_symbol}", &symver);'; \\ >> echo '}'; \\ >> - echo 'asm (\".type ${strong}, %gnu_indirect_function\");'; \\" >> + echo 'asm (".type ${strong}, %gnu_indirect_function");'; \\ >> +EOF >> # This is doing "libc_hidden_def (${strong})", but the compiler >> # doesn't know that we've defined ${strong} in the same file, so >> # we can't do it the normal way. >> - echo "\ >> - echo 'asm (\".globl __GI_${strong}\\n\"'; \\ >> - echo ' \"__GI_${strong} = ${strong}\");'; \\" >> + cat <> + echo 'asm (".globl __GI_${strong}");'; \\ >> + echo 'asm ("__GI_${strong} = ${strong}");'; \\ >> +EOF >> emit_weak_aliases >> - echo ' ) | $(compile-stdin.c) '"\ >> -\$(foreach p,\$(patsubst %$file,%,\$(basename \$(@F))),\$(\$(p)CPPFLAGS))" >> + cat <> + ) | \$(compile-stdin.c) \ >> +\$(foreach p,\$(patsubst %$file,%,\$(basename \$(@F))),\$(\$(p)CPPFLAGS)) >> +EOF >> fi >> >> if test $shared_only = t; then >> >> I checked builds for x86_64, i386, x32, and aarch64 for both dash and bash. > > This only affects x32. Please show the output of diff -up between > > 1. The old x32 sysd-syscalls under bash and the new x32 > sysd-syscalls under bash. > 2. The new x32 sysd-syscalls under bash and the new x32 > sysd-syscalls under dash. > The master still do not build for x32 on my setup with dash (ubuntu 14.04): (echo '#include '; \ echo 'extern void *time_ifunc (void) __asm ("time");'; \ echo 'void *'; \ echo 'time_ifunc (void)'; \ echo '{'; \ echo ' PREPARE_VERSION_KNOWN (symver, LINUX_2_6);'; \ echo ' return _dl_vdso_vsym ("__vdso_time", &symver);'; \ echo '}'; \ echo 'asm (".type time, %gnu_indirect_function");'; \ echo 'asm (".globl __GI_time /bin/sh: 10: Syntax error: Unterminated quoted string And it build with the modifications I proposed. The differences using bash with and without the patch are: $ diff -pu /tmp/master.bash /tmp/patch.bash --- /tmp/master.bash 2015-05-14 16:01:06.986718272 -0300 +++ /tmp/patch.bash 2015-05-14 16:07:41.450731250 -0300 @@ -36,6 +36,7 @@ $(foreach p,$(sysd-rules-targets),$(fore echo 'weak_alias (__gettimeofday, gettimeofday)'; \ echo 'libc_hidden_weak (gettimeofday)'; \ ) | $(compile-syscall) $(foreach p,$(patsubst %gettimeofday,%,$(basename $(@F))),$($(p)CPPFLAGS)) + $(foreach p,$(sysd-rules-targets),$(objpfx)$(patsubst %,$p,gettimeofday).os): \ $(..)sysdeps/unix/make-syscalls.sh $(make-target-directory) @@ -48,8 +49,8 @@ $(foreach p,$(sysd-rules-targets),$(objp echo ' return _dl_vdso_vsym ("__vdso_gettimeofday", &symver);'; \ echo '}'; \ echo 'asm (".type __gettimeofday, %gnu_indirect_function");'; \ - echo 'asm (".globl __GI___gettimeofday\n"'; \ - echo ' "__GI___gettimeofday = __gettimeofday");'; \ + echo 'asm (".globl __GI___gettimeofday");'; \ + echo 'asm ("__GI___gettimeofday = __gettimeofday");'; \ echo 'weak_alias (__gettimeofday, gettimeofday)'; \ echo 'libc_hidden_weak (gettimeofday)'; \ ) | $(compile-stdin.c) $(foreach p,$(patsubst %gettimeofday,%,$(basename $(@F))),$($(p)CPPFLAGS)) @@ -123,6 +124,7 @@ $(foreach p,$(sysd-rules-targets),$(fore echo '#define SYSCALL_ERRVAL 0'; \ echo '#include '; \ ) | $(compile-syscall) $(foreach p,$(patsubst %time,%,$(basename $(@F))),$($(p)CPPFLAGS)) + $(foreach p,$(sysd-rules-targets),$(objpfx)$(patsubst %,$p,time).os): \ $(..)sysdeps/unix/make-syscalls.sh $(make-target-directory) @@ -135,8 +137,8 @@ $(foreach p,$(sysd-rules-targets),$(objp echo ' return _dl_vdso_vsym ("__vdso_time", &symver);'; \ echo '}'; \ echo 'asm (".type time, %gnu_indirect_function");'; \ - echo 'asm (".globl __GI_time\n"'; \ - echo ' "__GI_time = time");'; \ + echo 'asm (".globl __GI_time");'; \ + echo 'asm ("__GI_time = time");'; \ ) | $(compile-stdin.c) $(foreach p,$(patsubst %time,%,$(basename $(@F))),$($(p)CPPFLAGS)) endif