[PATCH v1] Port ndbm

Richard Earnshaw (lists) Richard.Earnshaw@arm.com
Fri Jul 26 15:26:00 GMT 2019


Right, having reviewed the contents of the Arm version of sys/param.h, I 
agree that there's no point in keeping that version.  I've pushed the 
attached.

R.


On 26/07/2019 14:12, Richard Earnshaw (lists) wrote:
> 
> 
> On 26/07/2019 13:58, Joel Sherrill wrote:
>> On Fri, Jul 26, 2019 at 5:34 AM Vaibhav Gupta <vaibhavgupta40@gmail.com>
>> wrote:
>>
>>> On Fri, Jul 26, 2019, 3:49 PM Richard Earnshaw (lists) <
>>> Richard.Earnshaw@arm.com> wrote:
>>>
>>>>
>>>>
>>>> On 26/07/2019 10:09, Vaibhav Gupta wrote:
>>>>> On Fri, Jul 26, 2019, 2:31 PM Richard Earnshaw (lists) <
>>>>> Richard.Earnshaw@arm.com> 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 <
>>> vinschen@redhat.com
>>>>>
>>>>>>>> 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
>>>>>
>>>>>>
>>>>>>
>>>>
>>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-arm-remove-libc-sys-arm-sys-param.h.patch
Type: text/x-patch
Size: 1789 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20190726/ea90b34c/attachment.bin>


More information about the Newlib mailing list