Search code examples
gccgnulibcsysv

Building shared libc.so for System V ABI under GNU ABI


I need to build shared libc.so for System V ABI system under GNU ABI system from sources. I'm trying to build glibc2.16 if it is important.

My gcc compiler was built with the default --hash-style option set to "sysv". Every application built with it has System V ABI. Every, but not libc.

Tried to add C*FLAGS -Wl,--hash-style=sysv, but it didn't work. Configure was done, but making stopped with errors:

glibc cannot be compiled without optimization

I found that it is because of gcc options order. So, I decided to put necessary options by myself. Found --hash-style=both in Makeconfig and configure.in. Changed it to sysv. All libs (ld.so and other) were eventually built appropriate with System V. All except libc.so.

Do you know, how to build exactly libc.so? Thanks!


Solution

  • After different combinations of configuration options I got an answer. The right configuration commands:

    For x32 systems:

    ../configure --prefix=... --enable-kernel=2.4.0 --with-cpu=i686 --build=i686-unknown-linux-gnu CC="gcc -i686" CXX="g++ -i686"
    

    For x64 systems:

    ../configure --prefix=... --enable-kernel=2.4.0 --with-cpu=i686 --build=i686-unknown-linux-gnu CC="gcc -m32" CXX="g++ -m32"
    

    And you need to export CFLAGS with the next value:

    export CFLAGS="-mtune=native -O2 -pipe"