This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
RE: Multiple versions of routines tuned for different devices
- From: "Schwarz, Konrad" <konrad dot schwarz at siemens dot com>
- To: David Gilbert <david dot gilbert at linaro dot org>, "newlib at sourceware dot org" <newlib at sourceware dot org>
- Cc: Greta Yorsh <Greta dot Yorsh at arm dot com>
- Date: Tue, 15 Nov 2011 14:01:10 +0100
- Subject: RE: Multiple versions of routines tuned for different devices
- References: <CA+1XiSeyj1BmY4VTdzvtbwgSVs2bE+2K80jBcoEGrGxAdd2vmA@mail.gmail.com>
> -----Original Message-----
> From: newlib-owner@sourceware.org
> [mailto:newlib-owner@sourceware.org] On Behalf Of David Gilbert
> Sent: Friday, November 11, 2011 7:55 PM
> To: newlib@sourceware.org
> Cc: Greta Yorsh
> Subject: Multiple versions of routines tuned for different devices
>
> Hi,
> What's the right way to include multiple versions of string/memory
> routines, where the appropriate
> choice can't be determined from compiler defines?
> We could just pass an extra -D in somewhere.
I'm not an expert, but GCC has "spec files" that are used to
construct arguments to the subprograms the GCC driver program
invokes. These arguments include -D flags to the
C preprocessor/compiler.
The spec file syntax allows constructing arguments depending
on the arguments passed to the driver program.
For instance, GCC for the Power(PC) supports flags for the
(obsolete) "yellowknife", "MVME", and "ADS" single-board
computers.
I think the right thing to do would be to extend the standard
GCC spec file for ARM (and similarly for other architectures)
to generate defines according to the passed -mtune parameter.
This would ensure that a single option (-mtune) is responsible
for selecting the processor type. Otherwise, you would need
to ensure that the -mtune and -D__ARM_CORTEX_A9 arguments
are the same.
Konrad