freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] Position Independent Port of FreeType2


From: Dmitry Timoshkov
Subject: Re: [ft-devel] Position Independent Port of FreeType2
Date: Wed, 21 Jan 2009 00:34:37 +0800

"Mickey Gabel" <address@hidden> wrote:

  const int x = 0; /* no problem */
  const int* p = &x; /* needs address fixup - can't be used in PIC */
  char  *list1[] = {"zero", "one", "two"}; /* pointers need fixup */
  char  list2[3][5] = {"zero", "one", "two"}; /* OK, no problem */

FT2 uses lots a lot of such constants, such as arrays of pointers to structs and function tables. This is pervasive throughout all parts of FT2.

The Changes
-----------
I propose adding an FT_CONFIG_OPTION_PIC switch that if defined, will allow FT2 to compile to PIC: * The previously global const structures will now be part of some internal structure. For example inside FT_LibraryRec_ (there are other options). * Additional init functions will be called at library init (during FT_Init_FreeType) that will generate the structures, arrays, tables, and pointers at run time. * Ideally, each structure/table/array/whatever only needs to be written once (via a macro?), and depending on FT_CONFIG_OPTION_PIC either a global const is generated, or a struct member with a matching init function to be called.
* From what I could see, most parts of FT2 use such global constants.
* Ideally, the internal FT2 API would not be modified.
* We only use a subset (around 25% maybe?) of FT2.

I'd suggest to get a compiler that is able to generate the PIC code without
requiring to add ugly code modifications you are proposing. For instance
gcc for a linux platform does generate PIC code just fine.

--
Dmitry.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]