From: "Arnd Bergmann" <arnd@arndb.de>
To: "Geert Uytterhoeven" <geert@linux-m68k.org>
Cc: "John Paul Adrian Glaubitz" <glaubitz@physik.fu-berlin.de>,
"Kolbjørn Barmen" <linux-m68k@kolla.no>,
"port-m68k@netbsd.org" <port-m68k@netbsd.org>,
"debian-68k@lists.debian.org" <debian-68k@lists.debian.org>,
"linux-m68k@vger.kernel.org" <linux-m68k@vger.kernel.org>,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Subject: Re: Preliminary results - was: Re: Question on BIGGEST_ALIGNMENT in GCC on NetBSD/m68k
Date: Wed, 07 Jan 2026 09:19:59 +0100 [thread overview]
Message-ID: <baadfe05-0893-4182-8c7e-7ea816aee905@app.fastmail.com> (raw)
In-Reply-To: <CAMuHMdWVwXq+PzW_K1Lkn3hCAZuL4ps2VPEng4tB4wuhT+oytA@mail.gmail.com>
On Tue, Jan 6, 2026, at 20:31, Geert Uytterhoeven wrote:
> On Tue, 6 Jan 2026 at 16:38, Arnd Bergmann <arnd@arndb.de> wrote:
>> On Tue, Jan 6, 2026, at 14:40, John Paul Adrian Glaubitz wrote:
>> > On Tue, 2026-01-06 at 14:34 +0100, Kolbjørn Barmen wrote:
>> The diffstat is
>>
>> 407 files changed, 2433 insertions(+), 754 deletions(-)
>>
>> and I think this touches around 1500 structures, though
>> most files only have a single one.
>
> Thanks, this seems to work fine for atari_defconfig, and generates
> the exact same code as before.
Ok, good. The more interesting bit then is what happens when
you actually turn on -malign-int for the kernel itself. There
are many drivers that change behavior, but mostly this is going
to be a fix rather than a regression. As far as I can tell, this
change is all that should be needed for atari:
diff --git a/arch/m68k/include/asm/atarihw.h b/arch/m68k/include/asm/atarihw.h
index 9a038a3edb83..467005598fc6 100644
--- a/arch/m68k/include/asm/atarihw.h
+++ b/arch/m68k/include/asm/atarihw.h
@@ -334,7 +334,7 @@ struct TT_DMA {
u_char dma_cnt_lmd;
u_char char_dummy7;
u_char dma_cnt_lo;
- u_long dma_restdata;
+ u_long dma_restdata __packed;
u_short dma_ctrl;
};
#define tt_scsi_dma ((*(volatile struct TT_DMA *)TT_SCSI_DMA_BAS))
@@ -417,13 +417,13 @@ struct BLITTER
u_short halftone[16];
u_short src_x_inc;
u_short src_y_inc;
- u_long src_address;
+ u_long src_address __packed;
u_short endmask1;
u_short endmask2;
u_short endmask3;
u_short dst_x_inc;
u_short dst_y_inc;
- u_long dst_address;
+ u_long dst_address __packed;
u_short wd_per_line;
u_short ln_per_bb;
u_short hlf_op_reg;
diff --git a/arch/m68k/include/asm/openprom.h b/arch/m68k/include/asm/openprom.h
index 6456ba40a946..741e83d76ff2 100644
--- a/arch/m68k/include/asm/openprom.h
+++ b/arch/m68k/include/asm/openprom.h
@@ -78,7 +78,7 @@ struct linux_arguments_v0 {
int dev_partition;
char *kernel_file_name;
void *aieee1; /* XXX */
-};
+} __packed;
/* V2 and up boot things. */
struct linux_bootargs_v2 {
> However, m68k allmodconfig fails with:
>
> In file included from tools/include/nolibc/nolibc.h:97,
> from tools/include/nolibc/stddef.h:8,
> from ./usr/include/scsi/fc/fc_els.h:14,
> from <command-line>:
> tools/include/nolibc/types.h:120:1: error: padding struct size to
> alignment boundary with 1 bytes [-Werror=padded]
> 120 | };
> | ^
> cc1: all warnings being treated as errors
> make[4]: *** [usr/include/Makefile:85:
> usr/include/scsi/fc/fc_els.hdrtest] Error 1
>
> This is due to struct linux_dirent64 in tools/include/nolibc/types.h.
> The same definition in include/linux/dirent.h doesn't cause issues.
I left out the nolibc changes, as Thomas Weißschuh has already
posted patches to remove the dependency entirely. This is what
I use for testing with nolibc at the moment:
diff --git a/tools/include/nolibc/netinet/in.h b/tools/include/nolibc/netinet/in.h
new file mode 100644
index 000000000000..a6a1b19f5242
--- /dev/null
+++ b/tools/include/nolibc/netinet/in.h
@@ -0,0 +1 @@
+#include <linux/in.h>
diff --git a/tools/include/nolibc/std.h b/tools/include/nolibc/std.h
index 392f4dd94158..3fe83a4f7a2d 100644
--- a/tools/include/nolibc/std.h
+++ b/tools/include/nolibc/std.h
@@ -25,7 +25,7 @@ typedef unsigned int mode_t;
typedef signed int pid_t;
typedef unsigned int uid_t;
typedef unsigned int gid_t;
-typedef unsigned long nlink_t;
+typedef unsigned int nlink_t;
typedef int64_t off_t;
typedef signed long blksize_t;
typedef signed long blkcnt_t;
diff --git a/tools/include/nolibc/stdlib.h b/tools/include/nolibc/stdlib.h
index f184e108ed0a..497cbe1b5dba 100644
--- a/tools/include/nolibc/stdlib.h
+++ b/tools/include/nolibc/stdlib.h
@@ -19,6 +19,7 @@
struct nolibc_heap {
size_t len;
+ char __pad[__alignof__(struct {} __attribute__((__aligned__))) - __alignof__(size_t)];
char user_p[] __attribute__((__aligned__));
};
diff --git a/tools/include/nolibc/sys/socket.h b/tools/include/nolibc/sys/socket.h
new file mode 100644
index 000000000000..1d97008308ea
--- /dev/null
+++ b/tools/include/nolibc/sys/socket.h
@@ -0,0 +1,26 @@
+#include "../nolibc.h"
+
+#ifndef _NOLIBC_SYS_SOCKET_H
+#define _NOLIBC_SYS_SOCKET_H
+
+#include <linux/socket.h>
+
+typedef __kernel_sa_family_t sa_family_t;
+
+/*
+ * 1003.1g requires sa_family_t and that sa_data is char.
+ */
+
+struct sockaddr {
+ sa_family_t sa_family; /* address family, AF_xxx */
+#ifdef __clang__
+ char sa_data[14]; /* prevent -Wgnu-variable-sized-type-not-at-end warning */
+#else
+ union {
+ char sa_data_min[14]; /* Minimum 14 bytes of protocol address */
+ __DECLARE_FLEX_ARRAY(char, sa_data);
+ };
+#endif
+};
+
+#endif
diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h
index 470a5f77bc0f..a3193424e818 100644
--- a/tools/include/nolibc/types.h
+++ b/tools/include/nolibc/types.h
@@ -10,6 +10,8 @@
#ifndef _NOLIBC_TYPES_H
#define _NOLIBC_TYPES_H
+#include <linux/types.h>
+
#include "std.h"
#include <linux/mman.h>
#include <linux/stat.h>
@@ -116,7 +118,10 @@ struct linux_dirent64 {
int64_t d_off;
unsigned short d_reclen;
unsigned char d_type;
- char d_name[];
+ union {
+ char __pad[5];
+ __DECLARE_FLEX_ARRAY(char, d_name);
+ };
};
/* The format of the struct as returned by the libc to the application, which
@@ -124,8 +129,8 @@ struct linux_dirent64 {
*/
struct stat {
dev_t st_dev; /* ID of device containing file */
- ino_t st_ino; /* inode number */
mode_t st_mode; /* protection */
+ ino_t st_ino; /* inode number */
nlink_t st_nlink; /* number of hard links */
uid_t st_uid; /* user ID of owner */
gid_t st_gid; /* group ID of owner */
>> --- a/usr/include/Makefile
>> +++ b/usr/include/Makefile
>> @@ -6,7 +6,10 @@
>> #
>> # -std=c90 (equivalent to -ansi) catches the violation of those.
>> # We cannot go as far as adding -Wpedantic since it emits too many warnings.
>> -UAPI_CFLAGS := -std=c90 -Werror=implicit-function-declaration
>> +UAPI_CFLAGS := -std=c90 -Werror=implicit-function-declaration -Werror=padded
>> +
>> +# when cross-compiling with a minimal toolchain, use nolibc headers
>> +UAPI_CFLAGS += -I$(srctree)/tools/include/nolibc/
>
> Without the rest of the patch, this line on its own is already causing
> various allmodconfig failures for me:
>
> In file included from /usr/m68k-linux-gnu/include/sys/socket.h:26,
> from usr/include/linux/if.h:28,
> from ./usr/include/linux/netfilter_bridge/ebtables.h:17,
> from <command-line>:
> /usr/m68k-linux-gnu/include/bits/types/struct_iovec.h:26:8: error:
> redefinition of ‘struct iovec’
This should also be addressed by either my nolibc change or Thomas'
uapi cleanup.
> Dropping this line made the linux_dirent64 issue go away, and revealed
> a few more missing pieces, so here is a gmail-whitespace-damaged patch:
>
> diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h
> index 70eece6aa30e9306..4c10f5402d77757d 100644
> --- a/include/uapi/linux/xfrm.h
> +++ b/include/uapi/linux/xfrm.h
> @@ -27,7 +27,9 @@ struct xfrm_id {
> xfrm_address_t daddr;
> __be32 spi;
> __u8 proto;
> -};
> + __uapi_arch_pad8;
> + __uapi_arch_pad16;
> +} __uapi_arch_align;
>
> struct xfrm_sec_ctx {
> __u8 ctx_doi;
> @@ -255,6 +257,7 @@ struct xfrm_user_tmpl {
> __u8 mode;
> __u8 share;
> __u8 optional;
> + __uapi_arch_pad8;
> __u32 aalgos;
> __u32 ealgos;
> __u32 calgos;
>
Right, I missed this one because I had another patch in my
test tree that did a similar change but wasn't part of the
padding series.:
https://lore.kernel.org/all/20240216202657.2493685-1-arnd@kernel.org/
Arnd
next prev parent reply other threads:[~2026-01-07 8:20 UTC|newest]
Thread overview: 164+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-26 15:05 Question on BIGGEST_ALIGNMENT in GCC on NetBSD/m68k John Paul Adrian Glaubitz
2025-05-26 18:16 ` Jeffrey Walton
2025-05-26 18:23 ` John Paul Adrian Glaubitz
2025-05-26 18:48 ` Jeffrey Walton
2025-05-26 18:25 ` Jason Thorpe
2025-05-26 18:50 ` John Paul Adrian Glaubitz
2025-06-05 6:24 ` Jean-Michel Hautbois
2025-06-05 6:39 ` John Paul Adrian Glaubitz
2025-06-05 6:50 ` Jean-Michel Hautbois
2025-06-05 6:56 ` John Paul Adrian Glaubitz
2025-06-05 7:16 ` Geert Uytterhoeven
2025-06-05 7:36 ` John Paul Adrian Glaubitz
2025-06-05 8:49 ` Anders Magnusson
2025-06-05 10:33 ` Martin Husemann
2025-06-06 7:01 ` Geert Uytterhoeven
2025-06-07 9:44 ` John Paul Adrian Glaubitz
2025-06-06 10:20 ` Finn Thain
2025-06-07 9:44 ` John Paul Adrian Glaubitz
2025-06-07 9:58 ` Andreas Schwab
2025-06-07 10:02 ` Anders Magnusson
2025-06-07 11:11 ` Andreas Schwab
2025-06-07 12:55 ` Anders Magnusson
2025-06-07 13:57 ` John Paul Adrian Glaubitz
2025-06-07 13:53 ` John Paul Adrian Glaubitz
2025-06-07 13:50 ` John Paul Adrian Glaubitz
2025-06-07 14:38 ` Andreas Schwab
2025-06-07 14:54 ` John Paul Adrian Glaubitz
2025-06-07 15:03 ` Andreas Schwab
2025-06-07 15:19 ` John Paul Adrian Glaubitz
2025-06-07 15:20 ` Andreas Schwab
2025-06-07 15:23 ` John Paul Adrian Glaubitz
2025-06-07 15:37 ` Andreas Schwab
2025-06-07 15:51 ` John Klos
2025-06-07 16:55 ` Andreas Schwab
2025-06-07 18:43 ` Jason Thorpe
2025-06-07 21:43 ` Andreas Schwab
2025-06-07 23:06 ` Jason Thorpe
2025-06-10 11:16 ` John Paul Adrian Glaubitz
2025-06-11 1:31 ` Finn Thain
2025-06-08 1:10 ` Finn Thain
2025-06-08 11:47 ` Martin Husemann
2025-06-10 11:20 ` John Paul Adrian Glaubitz
2025-06-10 11:18 ` John Paul Adrian Glaubitz
2025-06-11 1:32 ` Finn Thain
2025-06-10 11:26 ` John Paul Adrian Glaubitz
2025-06-11 1:46 ` Finn Thain
2025-06-11 3:04 ` Stan Johnson
2025-06-11 7:44 ` John Paul Adrian Glaubitz
2025-06-11 15:32 ` Eero Tamminen
2025-06-11 15:49 ` John Paul Adrian Glaubitz
2025-06-12 14:54 ` Eero Tamminen
2025-06-13 1:36 ` Finn Thain
2025-06-13 10:56 ` Eero Tamminen
2025-06-13 11:12 ` John Paul Adrian Glaubitz
2025-06-14 0:58 ` Finn Thain
2025-06-13 11:22 ` John Paul Adrian Glaubitz
2025-06-13 13:21 ` John Klos
2025-06-13 13:33 ` John Paul Adrian Glaubitz
2025-06-13 20:10 ` Debian boot/login time Eero Tamminen
2025-06-14 1:13 ` Question on BIGGEST_ALIGNMENT in GCC on NetBSD/m68k Finn Thain
2025-06-12 1:54 ` Finn Thain
2025-06-12 7:18 ` John Paul Adrian Glaubitz
2025-06-12 10:00 ` Jason Thorpe
[not found] ` <CABq5eXH8S9MVoRi5znU+u7EJPmaRA+8yOyd-QKBJMQa10UoAmw@mail.gmail.com>
2025-06-12 7:27 ` John Paul Adrian Glaubitz
2025-06-12 8:19 ` Finn Thain
2025-06-13 11:15 ` John Paul Adrian Glaubitz
2025-06-14 1:06 ` Finn Thain
2025-06-12 8:25 ` Administrator @ R·V·E
2025-06-12 13:06 ` Christian Groessler
2025-06-13 11:16 ` John Paul Adrian Glaubitz
2025-06-16 11:54 ` Geert Uytterhoeven
2025-06-16 12:21 ` John Paul Adrian Glaubitz
2025-06-16 12:29 ` Geert Uytterhoeven
2025-06-16 15:39 ` Preliminary results - was: " John Paul Adrian Glaubitz
2025-06-22 22:13 ` Eero Tamminen
2025-06-23 6:34 ` John Paul Adrian Glaubitz
2025-06-23 7:13 ` Geert Uytterhoeven
2026-01-06 13:34 ` Kolbjørn Barmen
2026-01-06 13:40 ` John Paul Adrian Glaubitz
2026-01-06 14:23 ` John Paul Adrian Glaubitz
2026-01-06 15:37 ` Arnd Bergmann
2026-01-06 19:31 ` Geert Uytterhoeven
2026-01-07 8:19 ` Arnd Bergmann [this message]
2026-01-07 20:45 ` Finn Thain
2026-02-02 10:53 ` Geert Uytterhoeven
2026-07-02 12:43 ` Geert Uytterhoeven
2026-08-20 15:10 ` Geert Uytterhoeven
2026-01-06 21:30 ` John Paul Adrian Glaubitz
2026-02-11 10:41 ` Geert Uytterhoeven
2026-03-02 10:11 ` Geert Uytterhoeven
2025-06-13 11:55 ` Geert Uytterhoeven
2025-06-13 12:00 ` John Paul Adrian Glaubitz
2025-06-13 12:09 ` Geert Uytterhoeven
2025-06-13 12:23 ` John Paul Adrian Glaubitz
2025-06-13 12:30 ` Geert Uytterhoeven
2025-06-13 12:51 ` John Paul Adrian Glaubitz
2025-06-13 13:00 ` John Paul Adrian Glaubitz
2025-06-14 1:34 ` Finn Thain
2025-06-15 9:26 ` Geert Uytterhoeven
2025-06-16 6:48 ` John Paul Adrian Glaubitz
2025-06-13 13:01 ` ALeX Kazik
2025-06-14 1:46 ` Finn Thain
2025-06-13 14:15 ` Eero Tamminen
2025-06-13 14:53 ` John Paul Adrian Glaubitz
2025-06-13 15:24 ` Laurent Vivier
2025-06-14 7:21 ` John Paul Adrian Glaubitz
2025-06-15 1:42 ` Finn Thain
2025-06-15 8:13 ` John Paul Adrian Glaubitz
2025-06-15 9:30 ` Finn Thain
2025-06-16 7:31 ` John Paul Adrian Glaubitz
2025-06-18 3:50 ` Finn Thain
2025-06-18 9:16 ` John Paul Adrian Glaubitz
2025-06-18 9:36 ` Geert Uytterhoeven
2025-06-18 9:49 ` John Paul Adrian Glaubitz
2025-06-18 9:56 ` Geert Uytterhoeven
2025-06-18 10:04 ` John Paul Adrian Glaubitz
2025-06-18 10:51 ` Finn Thain
2025-06-18 12:21 ` Greg Ungerer
2025-06-18 12:27 ` John Paul Adrian Glaubitz
2025-06-18 12:54 ` Geert Uytterhoeven
2025-06-18 12:57 ` John Paul Adrian Glaubitz
2025-06-18 12:59 ` Greg Ungerer
2025-06-18 22:29 ` Finn Thain
2025-06-19 0:18 ` Greg Ungerer
2025-06-19 5:31 ` Finn Thain
2025-06-19 5:56 ` Greg Ungerer
2025-06-19 15:57 ` Jason Thorpe
2025-06-18 22:17 ` Finn Thain
2025-06-16 6:33 ` Laurent Vivier
2025-06-16 7:39 ` John Paul Adrian Glaubitz
2025-06-16 8:00 ` Laurent Vivier
2025-06-16 8:14 ` John Paul Adrian Glaubitz
2025-06-16 8:32 ` Laurent Vivier
2025-06-16 8:45 ` Geert Uytterhoeven
2025-06-16 9:07 ` John Paul Adrian Glaubitz
2025-06-16 9:00 ` John Paul Adrian Glaubitz
2025-06-16 9:10 ` Laurent Vivier
2025-06-16 9:15 ` John Paul Adrian Glaubitz
2025-06-16 9:26 ` Laurent Vivier
2025-06-16 9:32 ` John Paul Adrian Glaubitz
2025-06-16 9:45 ` Laurent Vivier
2025-06-16 10:07 ` Geert Uytterhoeven
2025-06-16 10:51 ` Laurent Vivier
2025-06-16 11:01 ` John Paul Adrian Glaubitz
2025-06-16 11:05 ` Laurent Vivier
2025-06-16 11:10 ` John Paul Adrian Glaubitz
2025-06-16 11:16 ` John Paul Adrian Glaubitz
2025-06-16 11:16 ` Laurent Vivier
2025-06-16 14:44 ` Jason Thorpe
2025-06-16 14:43 ` Jason Thorpe
2025-06-16 15:17 ` John Paul Adrian Glaubitz
2025-06-18 3:19 ` Finn Thain
2025-06-18 9:15 ` John Paul Adrian Glaubitz
2025-06-18 22:16 ` Finn Thain
2025-06-13 19:29 ` Eero Tamminen
2025-06-14 7:51 ` John Paul Adrian Glaubitz
2025-06-14 10:39 ` Eero Tamminen
2025-06-14 11:20 ` John Klos
2025-06-15 8:05 ` John Paul Adrian Glaubitz
2025-06-15 9:32 ` Geert Uytterhoeven
2025-06-16 6:42 ` John Paul Adrian Glaubitz
2025-06-14 1:29 ` Finn Thain
2025-06-13 16:26 ` David Brownlee
2025-06-16 6:39 ` John Paul Adrian Glaubitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=baadfe05-0893-4182-8c7e-7ea816aee905@app.fastmail.com \
--to=arnd@arndb.de \
--cc=debian-68k@lists.debian.org \
--cc=geert@linux-m68k.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-m68k@kolla.no \
--cc=linux-m68k@vger.kernel.org \
--cc=port-m68k@netbsd.org \
--cc=thomas.weissschuh@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox