rebuild of glibc-2.3.0 for kfreeBSD

Petr Salinger Petr.Salinger at t-systems.cz
Thu Nov 17 14:15:45 UTC 2005


> > 1) gcc-3.3 doesn't honour -fPIC properly
> > Proper fix is to fix gcc-3.3. Undefined  __PIC__  may causse problems also 
> > for other packages builded by gcc-3.3/g++-3.3.
> 
> Does gcc-3.3 define it on GNU/Linux ? 

Yes, tested with gcc version 3.3.6 (Debian 1:3.3.6-10) 
on linux-i386 and linux-amd64.

> If it does, then I don't understand why
> it doesn't for us, since we use the same config file in gcc sources (see
> [gcc]/gcc/config/linux.h and [gcc]/gcc/config/i386/linux.h).

Thanks for pointer ;-)

gcc/config/i386/linux.h:

#define TARGET_OS_CPP_BUILTINS()                \
  do                                            \
    {                                           \
        builtin_define_std ("linux");           \
        builtin_define_std ("unix");            \
        builtin_define ("__ELF__");             \
        builtin_define ("__gnu_linux__");       \
        builtin_assert ("system=posix");        \
        if (flag_pic)                           \
          {                                     \
            builtin_define ("__PIC__");         \
            builtin_define ("__pic__");         \
          }                                     \
    }                                           \
  while (0)

gcc/config/kfreebsd-gnu.h:


#undef TARGET_OS_CPP_BUILTINS    
#define TARGET_OS_CPP_BUILTINS()               \
  do                                           \
    {                                          \
       builtin_define ("__FreeBSD_kernel__");  \
       builtin_define ("__GLIBC__");           \
       builtin_define_std ("unix");            \
       builtin_define ("__ELF__");             \
       builtin_assert ("system=unix");         \
       builtin_assert ("system=posix");        \
    }                                          \
  while (0)

Now it is obvious.

> > There is one more problem - in /usr/src/kfreebsd5-headers/sys/timex.h
> > "#ifdef __FreeBSD__" have to be changed into "#ifdef __FreeBSD_kernel__"
> 
> Are you sure? 

Yes, moreover it is already fixed in kfreebsd-kernel-headers.
/usr/include/sys/timex.h has "#ifdef __FreeBSD_kernel__", 
but /usr/src/kfreebsd5-headers/sys/timex.h has "#ifdef __FreeBSD__".

And as Aurelian noted:
"The proper fix would be to use kfreebsd-kernel-headers. There are the 
kernel headers fix for userspace." 

But as path /usr/src/kfreebsd5-headers/ is hardcoded on some places, 
(i.e. /usr/include/sys/mount.h contains #include "/usr/src/kfreebsd5-headers/sys/mount.h")
it was easier for me to simply fix one file and rebuild libc.


Petr









More information about the Glibc-bsd-devel mailing list