Loading ...
Sorry, an error occurred while loading the content.

Shared libs fpic

Expand Messages
  • suresh kumar
    While creating shared libs, is it always must to have -fPIC or fpic? Will there be any harm if this option is ommited. Thanks Suresh V.V Suresh Kumar --
    Message 1 of 3 , Oct 1, 2004
    • 0 Attachment
      While creating shared libs, is it always must to have -fPIC or fpic?
      Will there be any harm if this option is ommited.
      Thanks
      Suresh

      V.V Suresh Kumar


      --
      ______________________________________________
      IndiaInfo Mail - the free e-mail service with a difference! www.indiainfo.com
      Check out our value-added Premium features, such as an extra 20MB for mail storage, POP3, e-mail forwarding, and ads-free mailboxes!

      Powered by Outblaze
    • Chandrashekar Babu
      ... As the man page of gcc says, the -fPIC option creates Position Independent Code which is a requirement for creating portable shared libraries. Ignoring
      Message 2 of 3 , Oct 1, 2004
      • 0 Attachment
        > While creating shared libs, is it always must to have -fPIC or fpic?
        > Will there be any harm if this option is ommited.

        As the man page of gcc says, the -fPIC option creates 'Position
        Independent Code' which is a requirement for creating portable shared
        libraries. Ignoring -fPIC option might improve performance of programs
        using your shared library for some cases, but I doubt if the shared
        library would work on all versions of GNU/Linux, or on a non-IA32
        hardware architecture.

        Cheers,
        Chandrashekar Babu.
      • Aneesh Kumar K.V
        ... It will. AFAIK the only difference is in the load time. During the load ( mmap/dlopen ) if you don t use -fpic it will try to resolve all the function
        Message 3 of 3 , Oct 1, 2004
        • 0 Attachment
          Chandrashekar Babu wrote:
          >>While creating shared libs, is it always must to have -fPIC or fpic?
          >>Will there be any harm if this option is ommited.
          >
          >
          > As the man page of gcc says, the -fPIC option creates 'Position
          > Independent Code' which is a requirement for creating portable shared
          > libraries. Ignoring -fPIC option might improve performance of programs
          > using your shared library for some cases, but I doubt if the shared
          > library would work on all versions of GNU/Linux, or on a non-IA32
          > hardware architecture.
          >

          It will. AFAIK the only difference is in the load time. During the load
          ( mmap/dlopen ) if you don't use -fpic it will try to resolve all the
          function address whereas with -fpic this is done during the actual
          function call using PLT.

          -aneesh
        Your message has been successfully submitted and would be delivered to recipients shortly.