Hi Michael, I suggest you file a gcc bug report. You would need to provide the .i file and compile options. Code simplification is helpful.
memset is typically provided by libc. One option might be for you to provide a simple implementation of it with your code. I don't believe this issue is hppa specific. The -ffreestanding option is handled by common code and the pa backend does not do anything with this option. The pa backend also does not issue calls to memset. It doesn't deal with the initialization or layout of structs. But hppa is big endian. This and some other factors affect struct initialization and layout. Dave On 2026-08-07 5:42 a.m., Michael Tokarev wrote: > Source: gcc-16 > Version: 16.1.0-3 > Severity: normal > X-Debbugs-Cc: [email protected] > User: [email protected] > Usertags: hppa > > Building firmware with hppa and hppa64 gcc, with option > -ffreestanding. Starting with gcc-16, the following code > > struct tpm_log_entry le = { > .hdr.pcrindex = pcpes->pcrindex, > .hdr.eventtype = pcpes->eventtype, > }; > > causes the following error to me emitted at link time: > > hppa64-linux-gnu-ld.bfd: o64/ccode32flat.o: in function `hash_log_extend': > ccode32flat.o.tmp.c:(.text+0x5400): undefined reference to `memset' > hppa64-linux-gnu-ld.bfd: o64/ccode32flat.o(.text+0x5400): cannot reach memset > ccode32flat.o.tmp.c:(.text+0x5400): relocation truncated to fit: > R_PARISC_PCREL22F against undefined symbol `memset' > > The struct in question is a bit large, so it really needs > some memory zeroing in this case. But the compiler is given > -ffreestanding. > > Just in case, the code in question links in libgcc.a, but > it doesn't help either. > > Apparently this is only a problem for hppa (both 32 and 64 bits) > compilers, other compilers does the right thing here. > > This code worked fine when built with gcc-15 and before. > > Thanks, > > /mjt > -- John David Anglin [email protected]

