public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Jordi Sanfeliu <jordi@fibranet.cat>
To: newlib@sourceware.org
Subject: undefined reference to '__builtin_mul_overflow'
Date: Fri, 25 Feb 2022 12:24:50 +0100	[thread overview]
Message-ID: <c65e6bf0-1851-d936-5bc1-8e17f59598da@fibranet.cat> (raw)

Hello,

I'm upgrading to Newlib 4.1.0 version (from Newlib 3.2.0) in my own 
hobby operating system FiwixOS for i386, and after a successful build 
with GCC 4.7.4 and Binutils 2.23.2, I found that I'm unable to compile a 
simple C program:

# cat test.c
#include <stdio.h>

int main(void)
{
	printf("newlib version %s\n", _NEWLIB_VERSION);
	return 0;
}

# gcc -o test test.c
/usr/lib/gcc/i686-pc-fiwix/4.7.4/../../../../i686-pc-fiwix/lib/libc.a(lib_a-callocr.o): 
In function `_calloc_r':
/mnt/builds/build-newlib-4.1.0.final/i386-fiwix/newlib/libc/stdlib/../../../../../newlib-4.1.0/newlib/libc/stdlib/mallocr.c:3210: 
undefined reference to `__builtin_mul_overflow'
collect2: error: ld returned 1 exit status


Looking in the Newlib 4.2.0 source code, I'm indeed unable to find the 
function '__builtin_mul_overflow'. This is what 'grep' says:

# grep -r __builtin_mul_overflow *
newlib/libc/stdlib/mallocr.c:  if 
(__builtin_mul_overflow((INTERNAL_SIZE_T) n, (INTERNAL_SIZE_T) 
elem_size, &sz))
newlib/libc/stdlib/nano-mallocr.c:    if (__builtin_mul_overflow (n, 
elem, &bytes))
newlib/libc/stdlib/reallocarray.c:	if (__builtin_mul_overflow (nmemb, 
size, &bytes))

There are references to it but I don't see where this function is defined.

Any idea what I'm missing here?
Regards.

-- 
Jordi Sanfeliu
FIBRANET Network Services Provider
https://www.fibranet.cat

             reply	other threads:[~2022-02-25 11:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25 11:24 Jordi Sanfeliu [this message]
2022-02-25 12:03 ` Sebastian Huber
2022-02-25 15:07   ` Jordi Sanfeliu

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=c65e6bf0-1851-d936-5bc1-8e17f59598da@fibranet.cat \
    --to=jordi@fibranet.cat \
    --cc=newlib@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).