Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jul 2021 18:36:20 +0000
From:      bugzilla-noreply@freebsd.org
To:        toolchain@FreeBSD.org
Subject:   [Bug 257132] clang 12.0.1 fails to cross-compile kern_mbuf - amd64 host, i386 target
Message-ID:  <bug-257132-29464-vgpqEbSVg5@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-257132-29464@https.bugs.freebsd.org/bugzilla/>
References:  <bug-257132-29464@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D257132

--- Comment #3 from Dimitry Andric <dim@FreeBSD.org> ---
It turns out that this is due some code generated in $OBJDIR/offset.inc, du=
ring
an amd64 to i386 cross-build:

# 33 "/usr/src/sys/sys/kpilite.h"
# 1 "./offset.inc" 1
#ifndef _OFFSET_INC_
#define _OFFSET_INC_
#if 0 /* disabled by -frewrite-includes */
#if !defined(GENOFFSET) && (!defined(KLD_MODULE) || defined(KLD_TIED))
#endif
#endif /* disabled by -frewrite-includes */
#if 1 /* evaluated by -frewrite-includes */
# 4 "./offset.inc"
struct thread_lite {
        u_char  pad_td_priority[0x27e - 0];
        u_char  td_priority;
        u_char  pad_td_critnest[0x30c - (0x27e + sizeof(u_char))];
        u_int   td_critnest;
        u_char  pad_td_owepreempt[0xb8 - (0x30c + sizeof(u_int))];
        u_char  td_owepreempt;
        u_char  pad_td_pinned[0xd8 - (0xb8 + sizeof(u_char))];
        int     td_pinned;
};
#endif

E.g. this defines tpad_td_owepreempt as a negative size:

27: error: array is too large (18446744073709551016 elements)
        u_char  pad_td_owepreempt[0xb8 - (0x30c + sizeof(u_int))];
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For some reason, generating this offset.inc file on a native i386 build res=
ults
in a very different struct:

struct thread_lite {
        u_char  pad_td_owepreempt[0xb8 - 0];
        u_char  td_owepreempt;
        u_char  pad_td_pinned[0xd8 - (0xb8 + sizeof(u_char))];
        int     td_pinned;
        u_char  pad_td_priority[0x27e - (0xd8 + sizeof(int))];
        u_char  td_priority;
        u_char  pad_td_critnest[0x30c - (0x27e + sizeof(u_char))];
        u_int   td_critnest;
};

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-257132-29464-vgpqEbSVg5>