This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A patch for PIC default



Hi,

I'm bringing up an old discussion.
>>>>> Ulrich Drepper wrote on 17 Nov 1998:

Ulrich> hjl@lucon.org (H.J. Lu) writes:
>> It seems to work for me. I removed the change to sysdeps/i386/bits/string.h.
>> It is correct since it is the installed header file and __PIC__ is defined
>> when -fPIC is used. I will send a patch for linuxthreads later.

Ulrich> Thanks for your efforts.  I have a few problems, though.

Ulrich> I understand the reason why these changes are necessary.  The questions are:

Ulrich> - why introducing yet another symbol SHARED?

Ulrich> - some files do have a different form .o and .os even for platforms where
Ulrich>   PIC is the default.  These files are all those which include versioning
Ulrich>   code.

There are some files which have different .o and .os forms which
aren't dependend on versioning code.  For example elf/dl-close.c has:
#ifdef PIC
          /* We will unlink the first object only if this is a statically
             linked program.  */
          assert (imap->l_prev != NULL);
          imap->l_prev->l_next = imap->l_next;
#else
          if (imap->l_prev != NULL)
            imap->l_prev->l_next = imap->l_next;
          else
            _dl_loaded = imap->l_next;
#endif

Other C files which are effected are elf/dl-open.c,
include/libc-symbols.h (this one might be ok), libio/freopen.c,
linuxthreads/cancel.c, linuxthreads/pthread.c, nss/nsswitch.c,
sysdeps/generic/libc-start.c, sysdeps/unix/sysv/linux/init-first.c,
...

How should we handle those files?  I guess Ralf introduced SHARED also
for this problem.

Ulrich> Therefore I think the correct change is this:

Ulrich> - remove defining PIC from the CFLAGS-.o  This cannot make any sense.

Ulrich> - somehow mark those object files which contain versioning stuff and
Ulrich>   therefore are only used in the shared object.


Ulrich> This way we can build a libc.a and libc_pic.a.  Both files mainly
Ulrich> contain the .o files but libc_pic.a has those .o files replaced by .os
Ulrich> files if they contain versioning information.

Ulrich> I think this is only an optimization and therefore will not be added
Ulrich> before 2.1.  Anybody volunteer to make such a patch for later?

Andreas
-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]