Re: assertion "ALIGNED_P(offset, obj->tlsalign)" failed: file "/usr/src/libexec/ld.elf_so/tls.c", line 549

Robert Elz <[email protected]> Wed, 22 Jul 2026 16:55:21 +0700
Newsgroups gmane.os.netbsd.current
Message-ID <[email protected]>
    Date:        Wed, 22 Jul 2026 11:47:29 +0200
    From:        Martin Husemann <[email protected]>
    Message-ID:  <[email protected]>

  | On Wed, Jul 22, 2026 at 04:39:33PM +0700, Robert Elz wrote:
  | > So, it runs this piece of code:
  | > 
  | >         offset = roundup2(_rtld_tls_static_offset, obj->tlsalign);
  | >         next_offset = offset + obj->tlssize;
  | > 	offset -= sizeof(struct tls_tcb);
  | > 
  | > 	assert(ALIGNED_P(offset, obj->tlsalign));
  |
  | (gdb) p sizeof(struct tls_tcb)
  | $1 = 8
  | (gdb) p obj->tlsalign
  | $2 = 64

That would certainly do it.   See if it all just works with the
assertion gone, it is pointless for the other 2 possible code paths
(unless one suspects that roundup2() is broken), and clearly wrong
for the one in question.

kre