Open ThomasWaldmann opened 6 years ago
OS: Ubuntu Linux 18.04 amd64 (pre-release)
I tried current master and d2ae637d commit (the one you used for the offered binaries), the error happens for both.
Any ideas?
@ThomasWaldmann What arguments are you passing to ./configure?
None. Should I?
Which version of gcc is being used for compiling? Probably gcc7, is this correct? If so, the compiler is generating the warning because string_size
is being cast to an unsigned long
which is potentially a 20 digit number (for example, 18446744073709551614) but s_name_buf
is a 9 char buffer so gcc thinks the buffer might not be big enough.
Here's the line of code that generates the warning:
snprintf (s_name_buf, SCNNMLEN + 1, "/%lu", (unsigned long) string_size);
s_name_buf
is defined like this in this repository:
char s_name_buf[SCNNMLEN + 1];
SCNNMLEN
is defined like this:
#define SCNNMLEN (8)
As can be seen here, a more up-to-date version of binutils has a fix for the issue:
/* The s_name field is defined to be NUL-padded but need not be
NUL-terminated. We use a temporary buffer so that we can still
sprintf all eight chars without splatting a terminating NUL
over the first byte of the following member (s_paddr). */
/* PR 21096: The +20 is to stop a bogus warning from gcc7 about
a possible buffer overflow. */
char s_name_buf[SCNNMLEN + 1 + 20];
@ThomasWaldmann I'd suggest passing the parameters shown here to ./configure
unless you have a reason to do otherwise.
gcc version 7.3.0 (Ubuntu 7.3.0-11ubuntu1)
Closing as outdated.
The project is moved to https://github.com/espressif/binutils-gdb repo (branch name pattern esp32ulp-elf-*
). Create issue in the new project if found something