Re: [PATCH v1] Port ndbm

"Richard Earnshaw (lists)" <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>

On 26/07/2019 13:58, Joel Sherrill wrote:
> On Fri, Jul 26, 2019 at 5:34 AM Vaibhav Gupta <[email protected]>
> wrote:
> 
>> On Fri, Jul 26, 2019, 3:49 PM Richard Earnshaw (lists) <
>> [email protected]> wrote:
>>
>>>
>>>
>>> On 26/07/2019 10:09, Vaibhav Gupta wrote:
>>>> On Fri, Jul 26, 2019, 2:31 PM Richard Earnshaw (lists) <
>>>> [email protected]> wrote:
>>>>
>>>>>
>>>>>
>>>>> On 24/07/2019 17:49, Corinna Vinschen wrote:
>>>>>> On Jul 24 10:47, Joel Sherrill wrote:
>>>>>>> On Wed, Jul 24, 2019 at 2:23 AM Corinna Vinschen <
>> [email protected]
>>>>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> On Jul 10 14:25, Vaibhav Gupta wrote:
>>>>>>>>> ---
>>>>>>>>>     newlib/libc/include/ndbm.h     |  93 ++++++++++++++
>>>>>>>>>     newlib/libc/search/Makefile.am |   1 +
>>>>>>>>>     newlib/libc/search/ndbm.c      | 217
>>>>> +++++++++++++++++++++++++++++++++
>>>>>>>>>     3 files changed, 311 insertions(+)
>>>>>>>>>     create mode 100644 newlib/libc/include/ndbm.h
>>>>>>>>>     create mode 100644 newlib/libc/search/ndbm.c
>>>>>>>>
>>>>>>>> Pushed.
>>>>>>>>
>>>>>>>
>>>>>>> Thank you.
>>>>>>>
>>>>>>> It touched a Makefile.am. Doesn't something need to be regenerated?
>>>>>>
>>>>>> Oh, right.  Done.
>>>>>>
>>>>>>
>>>>>> Corinna
>>>>>>
>>>>>
>>>>> I'm now seeing a build error on arm-eabi (though interestingly, not
>>>>> AArch64):
>>>>>
>>>>> /work/rearnsha/scratch/nightly/arm/trunk/./gcc/xgcc
>>>>> -B/work/rearnsha/scratch/nightly/arm/trunk/./gcc/ -nostdinc
>>>>> -B/work/rearnsha/scratch/nightly/arm/trunk/arm-eabi/thumb/newlib/
>>>>> -isystem
>>>>>
>>>
>> /work/rearnsha/scratch/nightly/arm/trunk/arm-eabi/thumb/newlib/targ-include
>>>>>
>>>>> -isystem
>>>>> /work/rearnsha/gnusrc/nightly/gcc-cross/trunk/newlib/libc/include
>>>>> -B/work/rearnsha/scratch/nightly/arm/trunk/arm-eabi/thumb/libgloss/arm
>>>>>
>>>
>> -L/work/rearnsha/scratch/nightly/arm/trunk/arm-eabi/thumb/libgloss/libnosys
>>>>>
>>>>> -L/work/rearnsha/gnusrc/nightly/gcc-cross/trunk/libgloss/arm
>>>>> -B/work/rearnsha/scratch/nightly/arm/trunk/testinstall/arm-eabi/bin/
>>>>> -B/work/rearnsha/scratch/nightly/arm/trunk/testinstall/arm-eabi/lib/
>>>>> -isystem
>>>>> /work/rearnsha/scratch/nightly/arm/trunk/testinstall/arm-eabi/include
>>>>> -isystem
>>>>>
>>> /work/rearnsha/scratch/nightly/arm/trunk/testinstall/arm-eabi/sys-include
>>>>> -L/work/rearnsha/scratch/nightly/arm/trunk/./ld  -mthumb
>>>>> -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\"
>>>>> -DPACKAGE_VERSION=\"3.1.0\" -DPACKAGE_STRING=\"newlib\ 3.1.0\"
>>>>> -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I.
>>>>> -I/work/rearnsha/gnusrc/nightly/gcc-cross/trunk/newlib/libc/search
>>>>> -fno-builtin -D_COMPILING_NEWLIB -DARM_RDI_MONITOR -DHAVE_INIT_FINI
>>>>> -g -O2  -mthumb -c -o lib_a-ndbm.o `test -f 'ndbm.c' || echo
>>>>>
>>>
>> '/work/rearnsha/gnusrc/nightly/gcc-cross/trunk/newlib/libc/search/'`ndbm.c
>>>>>
>> /work/rearnsha/gnusrc/nightly/gcc-cross/trunk/newlib/libc/search/ndbm.c:
>>>>> In function ‘dbm_open’:
>>>>>
>>>
>> /work/rearnsha/gnusrc/nightly/gcc-cross/trunk/newlib/libc/search/ndbm.c:67:12:
>>>>>
>>>>> error: ‘MAXPATHLEN’ undeclared (first use in this function)
>>>>>       67 |  char path[MAXPATHLEN];
>>>>>          |            ^~~~~~~~~~
>>>>>
>>>>> Does this file need to include sys/param.h?
>>>>>
>>>> Yah. sys/param.h has the macro definition of MAXPATHLEN
>>>> .
>>>> I guess ndbm.c has included it.
>>>
>>> Well, not included it.
>>>
>> I checked my patch, ndbm.c is including sys/param.h
>> .
>> Or you mean that you have not included it?
>>
> 
> I think the issue is that there is an arm specific sys/param.h which does
> not define MAXPATHLEN.
> 
> $ find . -name param.h | xargs -e grep MAXPATHLEN
> ./libc/include/sys/param.h:#define MAXPATHLEN PATH_MAX
> ./libc/sys/phoenix/sys/param.h:#define MAXPATHLEN       PATHSIZE
> ./libc/sys/rtems/include/sys/param.h: * MAXPATHLEN defines the longest
> permissible path length after expanding
> ./libc/sys/rtems/include/sys/param.h:#define    MAXPATHLEN      PATH_MAX
> 
> $ find . -name param.h | grep sys/param
> ./libc/include/sys/param.h
> ./libc/sys/linux/sys/param.h
> ./libc/sys/phoenix/sys/param.h
> ./libc/sys/rtems/include/sys/param.h
> ./libc/sys/arm/sys/param.h
> 
> Based on those commands, I the file ./libc/sys/arm/sys/param.h is the
> culprit. It is very minimal. It looks like a simple out of date copy of
> libc/include/sys/param.h.
> 
> My proposed fix is to delete libc/include/sys/arm/param.h. Does that work
> for you Richard?
> 

Or move some or all of it to machine/param.h, which is currently a 
placeholder.  Need to think about this a bit, but off to a meeting right 
now.

R.

> --joel
> 
> 
>>
>> Vaibhav Gupta
>>
>>>
>>> R.
>>>>
>>>> Vaibhav Gupta
>>>>
>>>>>
>>>>>
>>>
>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.