From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.5 (X11; Linux i686; U;) Gecko/20020606
Description of problem:
When compiling and linking a shared library module which references semctl
and/or shmctl, the compat-egcs package produces a shared library with
dependencies on glibc 2.2, so that the library can't be used on RedHat 6.2. On
RH 6.2, nm produces the following output:
[~] nm libfoo.so | fgrep GLIBC_2.2
U semctl@@GLIBC_2.2
U shmctl@@GLIBC_2.2
Version-Release number of selected component (if applicable):
How reproducible:
Always
Steps to Reproduce:
1. Write a C file with a function that reference semctl or shmctl.
2. Compile the C file, and link it into a shared library with egcs after
running the compat-egcs compatibility script.
3. Run nm on the shared library to see the symbols.
Actual Results: The shared library references GLIBC 2.2 versions of semctl and
shmctl.
Expected Results: The shared library should have referenced either unversioned
or GLIBC 2.1 (or GLIBC 2.0?) versions of semctl and shmctl.
Additional info:

After a day and a half of experimentation, I've come to the conclusion that
compat-egcs is ... seriously confusing. :) The only way I could create shared
libraries and executables that worked well on Red Hat 6.2 was to do the following:
1) run /usr/i386-glibc21-linux/bin/i386-glibc21-linux.sh to set the LDEMULATION
and GCC_EXEC_PREFIX environment variables correctly.
2) compile and link with gcc 2.96 driving, *not* with egcs. So with a simple
program, I'd compile as follows:
gcc -c test.c
3) When compiling C++ programs, I found that gcc 2.96 was not passing a flag
that the egcs subprograms expected, namely __cplusplus. So when compiling
a C++ program, I have to do:
g++ -D__cplusplus test.c
and then...
4) I found that I have to actually use gcc 2.96 to link, *not* egcs as I had
expected. The latter simply fails to work because it's using the wrong
object files/libraries when compiling. So again, the possibilities might
be:
gcc -o test test.o
gcc -shared -o libtest.so test.o
gcc -shared -o libtest.so test.o -lstdc++
g++ -shared -o libtest.so test.o
All of this leads me to wonder whether compat-egcs has been thoroughly tested
(never mind that it's completely undocumented...). Have I come to the correct
conclusions, or not?