public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug build/27199] New: elf-bfd.h implicitly declaring library function 'strncmp'
@ 2021-01-17 22:28 sean at seanbuller dot com
  2021-01-17 22:28 ` [Bug build/27199] " sean at seanbuller dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: sean at seanbuller dot com @ 2021-01-17 22:28 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27199

            Bug ID: 27199
           Summary: elf-bfd.h implicitly declaring library function
                    'strncmp'
           Product: gdb
           Version: 10.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: sean at seanbuller dot com
  Target Milestone: ---

The static function bfd_section_is_ctf in elf-bfd.h uses <string.h> function:
strncmp. When the gdb/gdb/configure step is executes the link test "checking
for ELF support in BFD", it can fail with the following error.

configure:16840: gcc -o conftest -I../../gdb/gdb/../include -I../bfd
-I../../gdb/gdb/../bfd -g -O2 -I../libiconv/include -L../bfd -L../libiberty
-L../zlib    conftest.c -lbfd -liberty -lz  -lncurses -lm  >&5
In file included from conftest.c:172:
../../gdb/gdb/../bfd/elf-bfd.h:3085:10: error: implicitly declaring library
function 'strncmp' with type 'int (const char *, const char *, unsigned long)'
[-Werror,-Wimplicit-function-declaration]
  return strncmp (name, ".ctf", 4) == 0 && (name[4] == 0 || name[4] == '.');
         ^
../../gdb/gdb/../bfd/elf-bfd.h:3085:10: note: include the header <string.h> or
explicitly provide a declaration for 'strncmp'
1 error generated.


Build parameters:

Compiler:
Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin20.2.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

 $ /Users/<removed>/gdb/gdb/configure --srcdir=../../gdb/gdb
--cache-file=./config.cache --prefix=/usr/local/toolchain --disable-nls
--disable-sim --disable-gas --disable-binutils --disable-ld --disable-gprof
--with-libexpat --with-lzma=no --with-python=yes
--program-transform-name=s&^&arm-none-eabi-& --disable-option-checking
--build=x86_64-apple-darwin20.2.0 --host=x86_64-apple-darwin20.2.0
--target=arm-none-eabi

## --------- ##
## Platform. ##
## --------- ##

hostname = MacBook-Pro
uname -m = x86_64
uname -r = 20.2.0
uname -s = Darwin
uname -v = Darwin Kernel Version 20.2.0: Wed Dec  2 20:40:21 PST 2020;
root:xnu-7195.60.75~1/RELEASE_ARM64_T8101

/usr/bin/uname -p = i386
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
         Darwin Kernel Version 20.2.0: Wed Dec  2 20:40:21 PST 2020;
root:xnu-7195.60.75~1/RELEASE_ARM64_T8101
Kernel configured for up to 8 processors.
8 processors are physically available.
8 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3 4 5 6 7
Primary memory available: 16.00 gigabytes
Default processor set: 483 tasks, 2225 threads, 8 processors
Load average: 14.30, Mach factor: 1.49
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

I see 2 solutions for this issue:
1. elf-bfd.h shall include "#include <string.h>"
2. gdb/gdb/configure shall include "#include <string.h>" as part of the
link-test for "checking for ELF support in BFD".

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug build/27199] elf-bfd.h implicitly declaring library function 'strncmp'
  2021-01-17 22:28 [Bug build/27199] New: elf-bfd.h implicitly declaring library function 'strncmp' sean at seanbuller dot com
@ 2021-01-17 22:28 ` sean at seanbuller dot com
  2021-01-17 22:50 ` sean at seanbuller dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: sean at seanbuller dot com @ 2021-01-17 22:28 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27199

Sean <sean at seanbuller dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sean at seanbuller dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug build/27199] elf-bfd.h implicitly declaring library function 'strncmp'
  2021-01-17 22:28 [Bug build/27199] New: elf-bfd.h implicitly declaring library function 'strncmp' sean at seanbuller dot com
  2021-01-17 22:28 ` [Bug build/27199] " sean at seanbuller dot com
@ 2021-01-17 22:50 ` sean at seanbuller dot com
  2021-01-18  1:41 ` simark at simark dot ca
  2021-01-18  6:26 ` sean at seanbuller dot com
  3 siblings, 0 replies; 5+ messages in thread
From: sean at seanbuller dot com @ 2021-01-17 22:50 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27199

Sean <sean at seanbuller dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
               Host|                            |x86_64-apple-darwin20.2.0
             Target|                            |arm-none-eabi

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug build/27199] elf-bfd.h implicitly declaring library function 'strncmp'
  2021-01-17 22:28 [Bug build/27199] New: elf-bfd.h implicitly declaring library function 'strncmp' sean at seanbuller dot com
  2021-01-17 22:28 ` [Bug build/27199] " sean at seanbuller dot com
  2021-01-17 22:50 ` sean at seanbuller dot com
@ 2021-01-18  1:41 ` simark at simark dot ca
  2021-01-18  6:26 ` sean at seanbuller dot com
  3 siblings, 0 replies; 5+ messages in thread
From: simark at simark dot ca @ 2021-01-18  1:41 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27199

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca

--- Comment #1 from Simon Marchi <simark at simark dot ca> ---
I think this was fixed in master with commit

commit b413232211bf7c7754095b017f27774d70646489
Author: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Date:   Sat Nov 28 11:45:06 2020 -0500

    GDB: Fix detection of ELF support when configuring with
-Werror=implicit-function-declaration

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug build/27199] elf-bfd.h implicitly declaring library function 'strncmp'
  2021-01-17 22:28 [Bug build/27199] New: elf-bfd.h implicitly declaring library function 'strncmp' sean at seanbuller dot com
                   ` (2 preceding siblings ...)
  2021-01-18  1:41 ` simark at simark dot ca
@ 2021-01-18  6:26 ` sean at seanbuller dot com
  3 siblings, 0 replies; 5+ messages in thread
From: sean at seanbuller dot com @ 2021-01-18  6:26 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27199

Sean <sean at seanbuller dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Sean <sean at seanbuller dot com> ---
Thanks Simon. I will cherry-pick this patch locally until the next release.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-18  6:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-17 22:28 [Bug build/27199] New: elf-bfd.h implicitly declaring library function 'strncmp' sean at seanbuller dot com
2021-01-17 22:28 ` [Bug build/27199] " sean at seanbuller dot com
2021-01-17 22:50 ` sean at seanbuller dot com
2021-01-18  1:41 ` simark at simark dot ca
2021-01-18  6:26 ` sean at seanbuller dot com

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).