From patchwork Fri Dec 20 21:36:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 1214321 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-108289-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="JcG3Sn7w"; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.b="FAWimIzl"; dkim-atps=neutral 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 47fhvn4Kf8z9sP3 for ; Sat, 21 Dec 2019 08:39:01 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=mWodLYggjymuf1JzBFQSOQ9vQvJcvmfZIaT/BOdXOIC rit3gmdnBJuHWHcjICsu25b+9WKz7049I68ADxls0IO/581thkRi1D6lwi3CfVRW XRvxCTzwn1Tz2G/8D8OR1JYDAZhOy8Q0TGytW4TKQn4LoECF/9izacMl3/xVd8Hg = 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:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=eTRR2S3PoxXzg2OORuEaxwCsZhU=; b=JcG3Sn7wVEIVAcIiW PzedC2woV463yQFDCZ/olPoaoBBN8SUmKkxR4iLqRtGrO6mwNgYM4lusEmrHje+2 yeQLhUeTXVwqQ8hZdiJM9uuQPCowGFihbeadc9T/iousMsimiiov7IHly+NmKDkH 0ULZ7ud26O2+XP+aNYO4v4qb1M= Received: (qmail 128152 invoked by alias); 20 Dec 2019 21:38:28 -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 128065 invoked by uid 89); 20 Dec 2019 21:38:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail.efficios.com DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com F3BCD690A33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1576877904; bh=kglT/+/QDXNx173AsNtuBherjFERiYVzflIUAmMX+J8=; h=From:To:Date:Message-Id:MIME-Version; b=FAWimIzl1YO+qQZ8EZJIlmt/M3+QTy+91mR5uNn1K6qL14cfoyuIHNDl42bqDkj3J 2dwC8s+RrDhAgqcgirbvcRat7YGP6rDUK8gAMLRJfItEQSC1pXiwjrFrGUAnzyg7ty KlQFguJ+sUhqFomio1XB+sN/UeS6D8HQ/YeV6hXR+uoQxMb5HiZsvws+za1KzTwT1f LOhScnWlY3pgZQXOKC4NO7WfqBMiBPeOj8ElXfae1Pu59MJSSEGBCxsieTuKjZywVa uNJA9zXVKVAxJ6hAosyD/SxDo/H/3JeK1CUGcCYCXf2iL4mkR/d4bpwDC8cjNCbfHX zhlLW+EhUXSkg== From: Mathieu Desnoyers To: Carlos O'Donell Cc: Florian Weimer , Joseph Myers , Szabolcs Nagy , libc-alpha@sourceware.org Subject: [RFC PATCH glibc 08/13] build-many-glibcs.py: Implement update-syscalls command Date: Fri, 20 Dec 2019 16:36:45 -0500 Message-Id: <20191220213650.11281-9-mathieu.desnoyers@efficios.com> In-Reply-To: <20191220213650.11281-1-mathieu.desnoyers@efficios.com> References: <20191220213650.11281-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 From: Florian Weimer This command uses pre-built compilers to re-install the Linux headers from the current sources into a temporary location and runs glibc's “make update-syscalls-lists” against that. This updates the glibc source tree with the current system call numbers. --- scripts/build-many-glibcs.py | 65 ++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py index 58f2409b1d..eedaa55033 100755 --- a/scripts/build-many-glibcs.py +++ b/scripts/build-many-glibcs.py @@ -498,7 +498,10 @@ class Context(object): old_components = ('gmp', 'mpfr', 'mpc', 'binutils', 'gcc', 'linux', 'mig', 'gnumach', 'hurd') old_versions = self.build_state['compilers']['build-versions'] - self.build_glibcs(configs) + if action == 'update-syscalls': + self.update_syscalls(configs) + else: + self.build_glibcs(configs) self.write_files() self.do_build() if configs: @@ -689,6 +692,15 @@ class Context(object): for c in configs: self.glibc_configs[c].build() + def update_syscalls(self, configs): + """Update the glibc syscall lists.""" + if not configs: + self.remove_dirs(os.path.join(self.builddir, 'update-syscalls')) + self.remove_dirs(os.path.join(self.logsdir, 'update-syscalls')) + configs = sorted(self.glibc_configs.keys()) + for c in configs: + self.glibc_configs[c].update_syscalls() + def load_versions_json(self): """Load information about source directory versions.""" if not os.access(self.versions_json, os.F_OK): @@ -921,7 +933,7 @@ class Context(object): self.build_state = json.load(f) else: self.build_state = {} - for k in ('host-libraries', 'compilers', 'glibcs'): + for k in ('host-libraries', 'compilers', 'glibcs', 'update-syscalls'): if k not in self.build_state: self.build_state[k] = {} if 'build-time' not in self.build_state[k]: @@ -1169,6 +1181,16 @@ class LinuxHeadersPolicyForBuild(object): self.builddir = config.component_builddir('linux') self.headers_dir = os.path.join(config.sysroot, 'usr') +class LinuxHeadersPolicyForUpdateSyscalls(object): + """Names and directories for Linux headers. update-syscalls variant.""" + + def __init__(self, glibc, headers_dir): + self.arch = glibc.compiler.arch + self.srcdir = glibc.compiler.ctx.component_srcdir('linux') + self.builddir = glibc.ctx.component_builddir( + 'update-syscalls', glibc.name, 'build-linux') + self.headers_dir = headers_dir + def install_linux_headers(policy, cmdlist): """Install Linux kernel headers.""" arch_map = {'aarch64': 'arm64', @@ -1465,6 +1487,20 @@ class GlibcPolicyForBuild(GlibcPolicyDefault): cmdlist.add_command('check', ['make', 'check']) cmdlist.add_command('save-logs', [self.save_logs], always_run=True) +class GlibcPolicyForUpdateSyscalls(GlibcPolicyDefault): + """Build policy for glibc during update-syscalls.""" + + def __init__(self, glibc): + super().__init__(glibc) + self.builddir = glibc.ctx.component_builddir( + 'update-syscalls', glibc.name, 'glibc') + self.linuxdir = glibc.ctx.component_builddir( + 'update-syscalls', glibc.name, 'linux') + self.linux_policy = LinuxHeadersPolicyForUpdateSyscalls( + glibc, self.linuxdir) + self.configure_args.insert( + 0, '--with-headers=%s' % os.path.join(self.linuxdir, 'include')) + # self.installdir not set because installation is not supported class Glibc(object): """A configuration for building glibc.""" @@ -1535,6 +1571,28 @@ class Glibc(object): policy.extra_commands(cmdlist) cmdlist.cleanup_dir() + def update_syscalls(self): + if self.os == 'gnu': + # Hurd does not have system call tables that need updating. + return + + policy = GlibcPolicyForUpdateSyscalls(self) + logsdir = os.path.join(self.ctx.logsdir, 'update-syscalls', self.name) + self.ctx.remove_recreate_dirs(policy.builddir, logsdir) + cmdlist = CommandList('update-syscalls-%s' % self.name, self.ctx.keep) + cmdlist.add_command('check-compilers', + ['test', '-f', + os.path.join(self.compiler.installdir, 'ok')]) + cmdlist.use_path(self.compiler.bindir) + + install_linux_headers(policy.linux_policy, cmdlist) + + cmdlist.create_use_dir(policy.builddir) + policy.configure(cmdlist) + cmdlist.add_command('build', ['make', 'update-syscall-lists']) + cmdlist.cleanup_dir() + self.ctx.add_makefile_cmdlist('update-syscalls-%s' % self.name, + cmdlist, logsdir) class Command(object): """A command run in the build process.""" @@ -1702,7 +1760,8 @@ def get_parser(): parser.add_argument('action', help='What to do', choices=('checkout', 'bot-cycle', 'bot', - 'host-libraries', 'compilers', 'glibcs')) + 'host-libraries', 'compilers', 'glibcs', + 'update-syscalls')) parser.add_argument('configs', help='Versions to check out or configurations to build', nargs='*')