[Speex-dev] Re: os_support.h, libc overrides

Jean-Marc Valin jean-marc.valin at usherbrooke.ca
Tue Nov 6 13:45:34 PST 2007

> The TI C64x build produces bit-exact results with build 12825 (April
> 2007, a bit before 1.2beta2).  


> The C54x and C55x builds did not work
> because the manual allocation scheme was broken when misc.c was removed.
> The old override mechanism was:
> 1.  Define USER_MISC in config.h
> 2.  In, misc.c, include user_misc.h if USER_MISC is defined
> 3.  Put the allocation override code in user_misc.h.
> The result is that the override code is included in one source file
> (misc.c), so there are no duplicate definitions.  How would you like to
> see this implemented under the current structure?  Including the
> override functions in os_support.h does not work unless the overrides
> are also static inlines (otherwise duplicate definitions occur).  For
> code size efficiency, it would be nice if these functions were not
> required to be static inline.

Do you have any idea what the overhead is by having the functions 1) in
a C file 2) as static in os_support.h 3) as static inline in os_support.h?

> The function prototypes were removed from misc.h, so now they are
> defined nowhere when overrides are defined.  There is no way around that
> without some change to the source.
> What do you think?

OK, this is definitely something we need to fix. Basically, I brought in
these changes when splitting libspeex in two. I wanted the two libraries
to be independent of each other, so I couldn't have the allocation in a
C file (if I included misc.c in each library, I'd get link errors on
some platforms). So the only option was to define the functions in
os_support.h. I had to do the same with math_approx.c.

In terms of fixing the C5x builds, I can think of a few options:
1) Defining the functions as static or static inline if the overhead is
2) Creating a user_misc.c just for the C5x arch.
3) defining OS_SUPPORT_IMPLEMENTATION in one of the C files and making
user_misc.h only define the functions once. i.e. same as 2) but from a
header file.

Any of those you like? I'm open to other suggestions.


More information about the Speex-dev mailing list