From patchwork Thu Apr 21 14:49:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 613141 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 3qrM9d4WdFz9t0t for ; Fri, 22 Apr 2016 00:50:13 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=A9Jd1Mno; 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:to:from:subject:date:message-id:references :mime-version:content-type:cc:in-reply-to; q=dns; s=default; b=r 4pNO5wqMbXNId/aiNrL28aM/Uv51ozKR60H2uCis9jwZj3pQCnY+Zhfh05abGHVN it2mg0hvKT2BHZ5Gddm105P67+Hz/XRxFYz/v2udNF6kI2zA4uW402YqK0FPjRUv KI0IyYUwMZB8Y7Uarc8kooVEiUwJgSoJkyrzlKZCco= 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:to:from:subject:date:message-id:references :mime-version:content-type:cc:in-reply-to; s=default; bh=Wg6kCsW FzJ02NfBmWLXNMxZXar8=; b=A9Jd1MnooUXNPtilicGIaDLv0u3pbz7ULrY2q3x ISYb3kSLaCpmXoFc2eALuLSGxV46kb6s9bH1HFvfEe8RrO2tKMnbDNuj2KWLS172 vNmfIeQSW7pjVVO/ALwLxyTumI4SwMyUnWUoOJeLT86mgyvqZQUB8LhpimmkKBjG rlmo= Received: (qmail 56857 invoked by alias); 21 Apr 2016 14:50:06 -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 56838 invoked by uid 89); 21 Apr 2016 14:50:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 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 spammy=awk, 3940, Mention, 1 X-HELO: plane.gmane.org To: libc-alpha@sourceware.org From: Stefan Liebler Subject: Re: [PATCH 02/14] S390: Mention s390-specific gconv-modues before common ones. Date: Thu, 21 Apr 2016 16:49:36 +0200 Lines: 198 Message-ID: <5718E880.1090200@linux.vnet.ibm.com> References: <1456219278-5258-1-git-send-email-stli@linux.vnet.ibm.com> <1456219278-5258-3-git-send-email-stli@linux.vnet.ibm.com> <5710C229.2080000@redhat.com> Mime-Version: 1.0 Cc: Florian Weimer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 In-Reply-To: <5710C229.2080000@redhat.com> On 04/15/2016 12:27 PM, Florian Weimer wrote: > On 02/23/2016 10:21 AM, Stefan Liebler wrote: >> + ${AWK} 'BEGIN { emitted = 0 } \ >> + emitted || NF == 0 || $$1 ~ /^#/ { print; next; } \ >> + !emitted { emit_s390_modules(); emitted = 1; print; } \ > > I would like to suggest to put the awk script into a separate file (and > reflect it in the makefile dependencies). > > Florian > Okay. Done. Here is the updated ChangeLog: * sysdeps/s390/s390-64/Makefile ($(objpfx)gconv-modules-s390): Mention s390-specific gconv-modules before common ones. * sysdeps/s390/gconv-modules-s390.awk: New file. From d72d7ed0480722727350c29b2dcd5a202d532c19 Mon Sep 17 00:00:00 2001 From: Stefan Liebler Date: Thu, 21 Apr 2016 12:42:48 +0200 Subject: [PATCH 02/14] S390: Mention s390-specific gconv-modues before common ones. This patch changes the order in gconv-modules. Now the s390-specific modules are mentioned before the common ones, because these modules aren't used in all possible conversions. E.g. the converting-step from INTERNAL to UTF-16 used the common UTF-16.so module instead of UTF16_UTF32_Z9.so. The awk script is parsing the source gconv-modules file and copies it line by line. The s390 modules are emitted between the header-comments and the first common-code-module. ChangeLog: * sysdeps/s390/s390-64/Makefile ($(objpfx)gconv-modules-s390): Mention s390-specific gconv-modules before common ones. * sysdeps/s390/gconv-modules-s390.awk: New file. --- sysdeps/s390/gconv-modules-s390.awk | 81 +++++++++++++++++++++++++++++++++++++ sysdeps/s390/s390-64/Makefile | 36 +---------------- 2 files changed, 83 insertions(+), 34 deletions(-) create mode 100644 sysdeps/s390/gconv-modules-s390.awk diff --git a/sysdeps/s390/gconv-modules-s390.awk b/sysdeps/s390/gconv-modules-s390.awk new file mode 100644 index 0000000..344c7b3 --- /dev/null +++ b/sysdeps/s390/gconv-modules-s390.awk @@ -0,0 +1,81 @@ +# Emit s390 modules at top of gconv-modules file. +# Copyright (C) 2016 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + +BEGIN { + emitted = 0 +} + +emitted || NF == 0 || $1 ~ /^#/ { + print; + next; +} + +!emitted { + emit_s390_modules(); + emitted = 1; + print; +} + +function emit_s390_modules() { + # Emit header line. + print "# S/390 hardware accelerated modules"; + print_val("#", 8); + print_val("from", 24); + print_val("to", 24); + print_val("module", 24); + printf "cost\n"; + # Emit s390-specific modules. + modul("ISO-8859-1//", "IBM037//", "ISO-8859-1_CP037_Z900"); + modul("IBM037//", "ISO-8859-1//", "ISO-8859-1_CP037_Z900"); + modul("ISO-10646/UTF8/", "UTF-32//", "UTF8_UTF32_Z9"); + modul("UTF-32BE//", "ISO-10646/UTF8/", "UTF8_UTF32_Z9"); + modul("ISO-10646/UTF8/", "UTF-32BE//", "UTF8_UTF32_Z9"); + modul("UTF-16BE//", "UTF-32//", "UTF16_UTF32_Z9"); + modul("UTF-32BE//", "UTF-16//", "UTF16_UTF32_Z9"); + modul("INTERNAL", "UTF-16//", "UTF16_UTF32_Z9"); + modul("UTF-32BE//", "UTF-16BE//", "UTF16_UTF32_Z9"); + modul("INTERNAL", "UTF-16BE//", "UTF16_UTF32_Z9"); + modul("UTF-16BE//", "UTF-32BE//", "UTF16_UTF32_Z9"); + modul("UTF-16BE//", "INTERNAL", "UTF16_UTF32_Z9"); + modul("UTF-16BE//", "ISO-10646/UTF8/", "UTF8_UTF16_Z9"); + modul("ISO-10646/UTF8/", "UTF-16//", "UTF8_UTF16_Z9"); + modul("ISO-10646/UTF8/", "UTF-16BE//", "UTF8_UTF16_Z9"); + printf "\n# Default glibc modules\n"; +} + +function modul(from, to, file, cost) { + print_val("module", 8); + print_val(from, 24); + print_val(to, 24); + print_val(file, 24); + if (cost == 0) cost = 1; + printf "%d\n", cost; +} + +function print_val(val, width) { + # Emit value followed by tabs. + printf "%s", val; + len = length(val); + if (len < width) { + len = width - len; + nr_tabs = len / 8; + if (len % 8 != 0) nr_tabs++; + } + else nr_tabs = 1; + for (i = 1; i <= nr_tabs; i++) printf "\t"; +} diff --git a/sysdeps/s390/s390-64/Makefile b/sysdeps/s390/s390-64/Makefile index de249a7..094b1e9 100644 --- a/sysdeps/s390/s390-64/Makefile +++ b/sysdeps/s390/s390-64/Makefile @@ -39,40 +39,8 @@ $(patsubst %, $(inst_gconvdir)/%.so, $(s390x-iconv-modules)) : \ $(inst_gconvdir)/%.so: $(objpfx)%.so $(+force) $(do-install-program) -$(objpfx)gconv-modules-s390: gconv-modules - cp $< $@ - echo >> $@ - echo "# S/390 hardware accelerated modules" >> $@ - echo -n "module ISO-8859-1// IBM037// " >> $@ - echo " ISO-8859-1_CP037_Z900 1" >> $@ - echo -n "module IBM037// ISO-8859-1// " >> $@ - echo " ISO-8859-1_CP037_Z900 1" >> $@ - echo -n "module ISO-10646/UTF8/ UTF-32// " >> $@ - echo " UTF8_UTF32_Z9 1" >> $@ - echo -n "module UTF-32BE// ISO-10646/UTF8/ " >> $@ - echo " UTF8_UTF32_Z9 1" >> $@ - echo -n "module ISO-10646/UTF8/ UTF-32BE// " >> $@ - echo " UTF8_UTF32_Z9 1" >> $@ - echo -n "module UTF-16BE// UTF-32// " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module UTF-32BE// UTF-16// " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module INTERNAL UTF-16// " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module UTF-32BE// UTF-16BE// " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module INTERNAL UTF-16BE// " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module UTF-16BE// UTF-32BE// " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module UTF-16BE// INTERNAL " >> $@ - echo " UTF16_UTF32_Z9 1" >> $@ - echo -n "module UTF-16BE// ISO-10646/UTF8/ " >> $@ - echo " UTF8_UTF16_Z9 1" >> $@ - echo -n "module ISO-10646/UTF8/ UTF-16// " >> $@ - echo " UTF8_UTF16_Z9 1" >> $@ - echo -n "module ISO-10646/UTF8/ UTF-16BE// " >> $@ - echo " UTF8_UTF16_Z9 1" >> $@ +$(objpfx)gconv-modules-s390: ../sysdeps/s390/gconv-modules-s390.awk gconv-modules + ${AWK} -f $^ > $@ GCONV_MODULES = gconv-modules-s390 -- 2.5.5