Bug#1143851: hppa-linux-gnu-gcc does not honor -ffreestanding, generating referencs to memset

Michael Tokarev <[email protected]>
Newsgroups gmane.linux.debian.ports.hppa
Message-ID <178609576146.910144.4157151276987198690.reportbug__29939.7499462188$1786095928$gmane$org@localhost>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.