From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 784 invoked from network); 22 Mar 2022 15:07:28 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 22 Mar 2022 15:07:28 -0000 Received: (qmail 26407 invoked by uid 550); 22 Mar 2022 15:07:25 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 26370 invoked from network); 22 Mar 2022 15:07:24 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=vJeYUhAZaM+G4m6ud8nLMmEM+pqwZvAWtpOqXjHJi3E=; b=KJ9IuYTPd4kyjyhB57cGxqK9gEzOs+icLwNqtZdtDdRmGV0AONrwLdH5Nk6wAC7F0B vWLtVzbayEwU53opfUMuoQjrGBwCDY1jBIpENcK6e0c49bMFmUnBK5YGA//Vw6KxcrPP h20YTKb4G/0kDzzkqv86x7vSq6WtrwU3g25quUEQvoPINIymRiTpXVuGjI9hCgvMvs7C vfq7hRwHKO0NC3wCnTNgEoJsSMj2CIUEKwTrZHuK61IM7Xjzmd+m+LstAshlY2VKa7jp +vW5VlErcjybHJUN/nutWmckulQijefSrguSJfYEaUqtnJr6evMtVWMFkU5GwZ/FEhyu ihOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=vJeYUhAZaM+G4m6ud8nLMmEM+pqwZvAWtpOqXjHJi3E=; b=gCEUc96WJ+cyAk3NywsSdpvnLufql5fku08wp3b0C3XMv63OW8JhWzw/N8u3ov+qwR LWpvRZfRGtuDYQDbOSgBXtcHpnjypyWhC5CO1GM0Fbm6ycMm9nUePvB/1Ibv/mqT19Pu UfUIu3osZaMXWCYWyp6oB466+KVTd58BRV9Bu7Ee9pKr06GGrkQaj8583OwhvhEGfhXN 1/nssYXHvWJsoDwzrLT2zc1Z7a3RktZsCPgTrofMdyphVJey6ffdIJQDNluTSndPt2HQ w8lzqjWAV79ez4XKhY+VDOeuJYxsKckTEbsjyXTaxMsgg0jqwX3iDO8TVrzybe0DxGT2 yMNA== X-Gm-Message-State: AOAM530p/MnLDC/TDpytGmaT+htJHL3257cyp32YEoiAGwKzq+YY4TtL kXyLiSdLxEWbmDLOV9JGe4nDlfp2cVftElFE8mL9oSJ/U1k= X-Google-Smtp-Source: ABdhPJzS728cJ0yAOq/Tq0jK3lf6txZ3Moe0wmJ83KnQOIl92n8MccNbDyOXJV2pt5ju3R3TClY9naCfmXNpoP76MpI= X-Received: by 2002:a63:5810:0:b0:381:6562:46fb with SMTP id m16-20020a635810000000b00381656246fbmr21994673pgb.567.1647961632283; Tue, 22 Mar 2022 08:07:12 -0700 (PDT) MIME-Version: 1.0 References: <20220322125933.GB7074@brightrain.aerifal.cx> In-Reply-To: <20220322125933.GB7074@brightrain.aerifal.cx> From: Jeffrey Walton Date: Tue, 22 Mar 2022 11:06:41 -0400 Message-ID: To: musl@lists.openwall.com Cc: =?UTF-8?B?546L5rSq5Lqu?= , liuxue@loongson.cn, lvjianmin@loongson.cn Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [musl] add loongarch64 port On Tue, Mar 22, 2022 at 8:59 AM Rich Felker wrote: > On Tue, Mar 22, 2022 at 11:52:35AM +0800, =E7=8E=8B=E6=B4=AA=E4=BA=AE wro= te: ... > > +++ b/arch/loongarch64/bits/signal.h > > @@ -0,0 +1,79 @@ > > +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ > > + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOU= RCE) > > + > > +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOU= RCE) > > +#define MINSIGSTKSZ 4096 > > +#define SIGSTKSZ 16384 > > +#endif > > + > > +typedef unsigned long greg_t, gregset_t[32]; > > + > > +typedef struct sigcontext { > > + unsigned long pc; > > + gregset_t gregs; > > + unsigned int flags; > > + unsigned long extcontext[0] __attribute__((__aligned__(16))); > > +}mcontext_t; > > [0] is not valid, and having a flexible array member here is possibly > not even useful since I don't think it would be valid to access it via > uc->uc_mcontext.extcontext[] since the instance of mcontext_t inside > the ucontext struct does not have FAM space belonging to it, even if > additional space was allocated past the end of the ucontext_t. In > other words, I think compilers would be justified in treating attempts > to access it this way as UB and optimizing them out. I believe zero-length arrays are legal in C99. I'm not sure how well it applies here or to Musl on some (older?) platforms. Microsoft used to use [1] for ANYSIZE_ARRAY. Also see https://web.archive.org/web/20120209061713/http://blogs.msdn.com/b/oldnewth= ing/archive/2004/08/26/220873.aspx Jeff