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=-4.5 required=5.0 tests=MAILING_LIST_MULTI, NICE_REPLY_A,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 3772 invoked from network); 25 May 2022 10:08:41 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 25 May 2022 10:08:41 -0000 Received: (qmail 9297 invoked by uid 550); 25 May 2022 10:08:37 -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 9263 invoked from network); 25 May 2022 10:08:36 -0000 To: musl@lists.openwall.com References: <20220516142704.GR7074@brightrain.aerifal.cx> <5fe467cd-4b68-2841-8aae-c485e7570267@loongson.cn> <20220521082246.GA20105@voyager> <777071eb-d8c3-eb04-fef4-4f54d6016e8f@loongson.cn> <20220524123201.GU7074@brightrain.aerifal.cx> From: =?UTF-8?B?546L5rSq5Lqu?= Message-ID: <4978b83d-871a-e8ca-ab4b-6dec73f34075@loongson.cn> Date: Wed, 25 May 2022 18:08:23 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20220524123201.GU7074@brightrain.aerifal.cx> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID:AQAAf9Cxj+YXAI5i8yUBAA--.8120S3 X-Coremail-Antispam: 1UD129KBjvJXoW7Aw4ktryrJry5AryDWFWxJFb_yoW8uFWkpF WrCr1vyrWUGFnYkw1qya4jqry5uw4kGw15GF9xKa47Ar98XFn2gF1UWFyj9Fy5CrWkXF1j vr1UKr15uF4kt3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUv2b7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I 8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI 64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8Jw Am72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lc7I2V7IY0VAS07AlzVAYIcxG8wCY 02Avz4vE14v_Gw1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxV Aqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1j 6r15MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6x kF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE 14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa 7IU5PR63UUUUU== X-CM-SenderInfo: pzdqwxxrqjzxhdqjqz5rrqw2lrqou0/ Subject: Re: [musl] add loongarch64 port v3 在 2022/5/24 下午8:32, Rich Felker 写道: > What we've been trying to say is that there are several cases, none of > which seem to need it: > > 1. You create an object with declared type struct sigcontext. In this > case, the flexible array member at the end is not present at all > (because that's how C works) which means there's no extended > context which needs additional alignment and probably also means > this is not a usable way of creating sigcontext structs. > > 2. You malloc storage for the object with space for the flexible array > member. In this case the allocation has alignment max_align_t and > everything is fine. > > 3. You get the object from the kernel pushing it onto the stack in a > signal frame. This is probably actually the only case the type is > usable in, and of course it has whatever alignment the kernel gave > it. Specify the __attribute__((__aligned__(16))) in musl,is used to be consistent with kernel.if I removed the __attribute__((__aligned__(16))), there is a libc-test fail in pthread_cancel.exe.the reason is that the offset of uc->uc_mcontext from the start of uc obtained in cancel_handler is inconsistent with kernel pushing it onto the stack in a signal frame. so I understand the __attribute__((__aligned__(16))) is necessary in musl. src/thread/pthread_cancel.c static void cancel_handler(int sig, siginfo_t *si, void *ctx) {         pthread_t self = __pthread_self();         ucontext_t *uc = ctx;         uintptr_t pc = uc->uc_mcontext.MC_PC;          ... } musl/arch/loongarch64/bits/signal.h: typedef unsigned long greg_t, gregset_t[32]; typedef struct sigcontext {         unsigned long pc;         gregset_t gregs;         unsigned int flags;         unsigned long extcontext[]; }mcontext_t; linux/arch/loongarch/include/uapi/asm/sigcontext.h: struct sigcontext {         __u64   sc_pc;         __u64   sc_regs[32];         __u32   sc_flags;         __u64   sc_extcontext[0] __attribute__((__aligned__(16))); }; > > Rich