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

Luis Machado luis.machado@linaro.org
Tue Mar 30 11:58:21 GMT 2021


Hi Alan, Tom,

On 3/26/21 8:44 AM, Luis Machado wrote:
> On 3/25/21 7:31 PM, Mike Frysinger wrote:
>> On 25 Mar 2021 16:47, Luis Machado wrote:
>>> 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)
>>>         | ^~~~~~~~~~
>>
>> Alan's patch didn't include the regenerated bfd.h inputs, so you'll
>> have to do that on your side.
>> -mike
>>
> 
> Oops. Regenerated now. I gave it a try again and it worked OK.

Given this has been broken for a little while, and given Alan's patch 
fixes the problem for arm/aarch64 sims (from what I tested), can we push 
this for now and get it addressed in some other way later, if someone 
wants it?

I think someone's hit this on riscv as well.


More information about the Binutils mailing list