This is the mail archive of the
mailing list for the newlib project.
RE: Update newlib to support efficient string operation functions for Thumb.
- From: "Hale Wang" <Hale dot Wang at arm dot com>
- To: <newlib at sourceware dot org>, <vinschen at redhat dot com>
- Date: Tue, 19 Aug 2014 11:01:54 +0800
- Subject: RE: Update newlib to support efficient string operation functions for Thumb.
- Authentication-results: sourceware.org; auth=none
- References: <000601cfb776$33efa100$9bcee300$ at arm dot com> <20140814082817 dot GB17310 at calimero dot vinschen dot de>
I have done several test locally and found that maybe we can't just leave this wrapper blank. If we do this, the arm-none-eabi-gcc will report "undefined reference to `strlen` ".
The reason is that the libc/machine/arm/lib_a-strlen.o will always be generated even if we don't define this function, and this *.o will replace the default libc/string/lib_a-strlen.o.
The details are describled as following:
1. The libc.a is generated by the following scripts:
for i in string/lib.a machine/lib.a; do \
arm-none-eabi-ar x ../$i; \
arm-none-eabi-ar rc ../libc.a *.o
2. Firstly, lib_a-strlen.o is generated by the script ' arm-none-eabi-ar x string/lib.a '. And the default strlen() function is defined in this object file.
3. Then, another lib_a-strlen.o is generated by the script ' arm-none-eabi-ar x machine/lib.a '. This file will replace the previous object file immediately because they own the same name. And no function is defined in this object file.
4. Finally, strlen() is not defined in the libc.a generated. This will cause the link failure.
So we may need to turn back to our previous patch.
Thanks and Best Regards,
> -----Original Message-----
> From: Hale Wang [mailto:Hale.Wang@arm.com]
> Sent: 2014å8æ15æ 13:42
> To: email@example.com; 'firstname.lastname@example.org'
> Subject: RE: Update newlib to support efficient string operation functions for
> Hi Corinna,
> I agree. I just need to leave the wrapper blank. The libc/string/ will be
> automatically pulled in as the default definition.
> Thanks for your command. I will update this patch and do some testing locally
> before I send it out.
> Thanks and Best Regards,
> Hale Wang
> > -----Original Message-----
> > From: email@example.com [mailto:newlib-
> > firstname.lastname@example.org] On Behalf Of Corinna Vinschen
> > Sent: 2014å8æ14æ 16:28
> > To: email@example.com
> > Subject: Re: Update newlib to support efficient string operation
> > functions for Thumb.
> > Hi Hale,
> > On Aug 14 12:14, Hale Wang wrote:
> > > Hi,
> > >
> > > The source files in newlib/libc/machine/arm/ are not so efficient
> > > enough to sopport Thumb.
> > >
> > > For Cortex-M0, if we don't define '__OPTIMIZE_SIZE__' or
> > > 'PREFER_SIZE_OVER_SPEED' which means size is not preferred,
> > > inefficient code will be used. This may result in pool benchmark
> > performance.
> > >
> > > In this case, we can include newlib/libc/string/strcmp.c to improve
> > > the performance. And if size is preferred, the original code will be used.
> > >
> > > I have done some tests on Dhrystone benchmark, and the performance
> > > of
> > > Cortex-M0 can be improved to 13% with this solution.
> > >
> > > The strlen.c can be improved in the similar way.
> > >
> > > Bootstrap and no make check regression on X86-64.
> > This patch is a bit complicated. You're explicitely including
> > ../../string/*.c, but that's not necessary. What you should do is
> > this: Use #if to define the scenario in which the assembler code should not
> be used:
> > # if [thumb1 && no-size-opimization]
> > [code here]
> > #endif
> > The result is that the strlen/strcmp functions won't be defined in the
> > assembler-optimized files, and that will automatically pull in the
> > default C definitions of strlen/strcmp from libc/string. No reason to
> > include them explicitely.
> > Along the same lines, the strcmp-stub.c file should not be necessary.
> > Just don't define the strcmp() function in the assembler file in the
> > scenario you don't want it, and newlib will fall back to the C
> > function defined in libc/string/strcmp.c.
> > Corinna
> > --
> > Corinna Vinschen
> > Cygwin Maintainer
> > Red Hat