[PATCH] Add startswith function and use it instead of CONST_STRNEQ.

Luis Machado luis.machado@linaro.org
Thu Mar 25 19:47:59 GMT 2021


Hi,

On 3/25/21 8:54 AM, Alan Modra wrote:
> On Thu, Mar 25, 2021 at 07:53:04AM -0300, Luis Machado wrote:
>> On 3/22/21 7:56 PM, Alan Modra wrote:
>>> On Mon, Mar 22, 2021 at 01:13:00PM -0300, Luis Machado wrote:
>>>> Just FTR, I'm seeing breakage in sim/aarch64 and sim/arm. Both are
>>>> complaining about "-Werror=implicit-function-declaration" regarding strncmp
>>>> and strlen.
>>>>
>>>> Is this the breakage you're talking about? Just so I know what to expect
>>>> when it gets fixed.
>>>
>>> Yes.
>>>
>>
>> Thanks. Are there plans to address this or should I come up with a patch?
> 
> I posted a patch here
> https://sourceware.org/pipermail/binutils/2021-March/115863.html
> It's been tested with gdb, sim and binutils builds.
> 
> Tom offered to solve the problem himself, so I'm waiting on that or
> for someone in the gdb camp to review my patch.  Since I messed this
> up in the first place by taking a comment by Tom as a go-ahead rather
> than first posting a patch for proper review by gdb maintainers, I'm
> being a little cautious in committing the above patch.
> 

I applied the above patch to today's master binutils-gdb and gave 
configure's --enable-targets=all a try, but I ran into the following:

In file included from ../../../repos/binutils-gdb/bfd/archive.c:135:
./bfd.h:568:1: error: redefinition of ‘startswith’
   568 | startswith (const char *str, const char *prefix)
       | ^~~~~~~~~~
In file included from ../../../repos/binutils-gdb/bfd/sysdep.h:122,
                  from ../../../repos/binutils-gdb/bfd/archive.c:134:
../../../repos/binutils-gdb/bfd/../include/str-util.h:23:1: note: 
previous definition of ‘startswith’ was here
    23 | startswith (const char *str, const char *prefix)
       | ^~~~~~~~~~


More information about the Binutils mailing list