From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by sourceware.org (Postfix) with ESMTPS id 15249385740E for ; Sat, 5 Jun 2021 00:14:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 15249385740E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f43.google.com with SMTP id m18so10869717wrv.2 for ; Fri, 04 Jun 2021 17:14:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=re9MPrsthEpCoUn4XeHYyWlCZIX070nGcPWXu9cIcH0=; b=rY5p6eFWF/If9spkbkHGJ8mUZEx42j40RjfwcVpdUaUcHULaIWkLClKlha7t72e/oQ Vc4M4rSfgpd7ykNqnHgfyaHQc5sUqXrhsfs01Q2NWg33504xbBBrF3At3zFmcaPjcsov RJTua57bzo7Cn8sv4nXrulM63x3g/BQE8bRq4KyPq4skZgfVjFszN1EB+oXa5QY2+1xR xg9NuCfOzwBiyj1FDbfK2D5YaWPFX92U8+uCoqqViaHPyVQfsl0Ytp8gcLQoNZsIRK2l blkQDU9hhDLfqEWN9mg1ywQT+cn8OBeDzAXeSfQ5KXrs+325qWAsJqJYDnvERarZnUsf LLWQ== X-Gm-Message-State: AOAM533fPyJUm6iLrwnQcL/7u9QB7XNRgyfgWniTborjE4sYEWu2IckI 03yjuvNsRX4kuWXb6UYcDvgHknSODS10+g== X-Google-Smtp-Source: ABdhPJz+U9Wsv6kiXm8uXsYBAw6BOIs0Yj6ztwfjl1S4cCbAFekCv605K8yfZwDvsT5JC5U3xguxbQ== X-Received: by 2002:a5d:538c:: with SMTP id d12mr6073260wrv.116.1622852071512; Fri, 04 Jun 2021 17:14:31 -0700 (PDT) Received: from localhost ([2001:8a0:f932:6a00:6b6e:c7b6:c5a7:aac3]) by smtp.gmail.com with ESMTPSA id u8sm8789105wrb.77.2021.06.04.17.14.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Jun 2021 17:14:30 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 1/2] nat/amd64-linux-siginfo.c: Move align attribute from typedef to struct Date: Sat, 5 Jun 2021 01:14:26 +0100 Message-Id: <20210605001427.3597687-2-pedro@palves.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210605001427.3597687-1-pedro@palves.net> References: <20210605001427.3597687-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 00:14:43 -0000 Compiling GDB with current git Clang (future 13) fails with (among other problems), this issue: $ make nat/amd64-linux-siginfo.o CXX nat/amd64-linux-siginfo.o src/gdb/nat/amd64-linux-siginfo.c:590:35: warning: passing 4-byte aligned argument to 8-byte aligned parameter 1 of 'compat_x32_siginfo_from_siginfo' may result in an unaligned pointer access [-Walign-mismatch] compat_x32_siginfo_from_siginfo ((struct compat_x32_siginfo *) inf, ^ 1 warning generated. The problem is that: - The flagged code is casting to "struct compat_x32_siginfo" pointer directly instead of to a pointer to the compat_x32_siginfo_t typedef. The called function is declared with a compat_x32_siginfo_t typedef pointer parameter. - Only the typedef has the __aligned__ attribute. Fix this by moving the attribute to the struct, so both struct and typedef have the same alignment. The next patch removes the typedefs. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * nat/amd64-linux-siginfo.c (compat_x32_siginfo_t): Move __attribute__ __aligned__ from the typedef to the struct. --- gdb/nat/amd64-linux-siginfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/nat/amd64-linux-siginfo.c b/gdb/nat/amd64-linux-siginfo.c index e2d2db6e112..9ff9361487a 100644 --- a/gdb/nat/amd64-linux-siginfo.c +++ b/gdb/nat/amd64-linux-siginfo.c @@ -206,7 +206,7 @@ typedef struct compat_siginfo /* For x32, clock_t in _sigchld is 64bit aligned at 4 bytes. */ typedef long __attribute__ ((__aligned__ (4))) compat_x32_clock_t; -typedef struct compat_x32_siginfo +typedef struct __attribute__ ((__aligned__ (8))) compat_x32_siginfo { int si_signo; int si_errno; @@ -263,7 +263,7 @@ typedef struct compat_x32_siginfo int _fd; } _sigpoll; } _sifields; -} compat_x32_siginfo_t __attribute__ ((__aligned__ (8))); +} compat_x32_siginfo_t; /* To simplify usage of siginfo fields. */ -- 2.26.2