No. A newer version of foo
will override the older version of foo
. For glibc, this would mean you only have the new version. This will break everything. Red Hat provides something called Software Collections (SCL) that lets you install multiple RPMs such that they don't conflict, but there's no SCL for glibc.
I advice against using a version of RHEL 7's glibc on RHEL 6. It will probably look for things not available on RHEL 6. Perhaps you can build RHEL 7's glibc (with appropriate flags adjusted) on RHEL 6, put in a custom location and link against that explicitly? You would still have to maintain this glibc version yourself. You can make your application use a different libc by using an RPATH.
How do you set a custom RPATH? This answer has one possible approach:
RPATH specifies where the provided libraries are located. This folder should contain: libc.so.6, libdl.so.2, libgcc_s.so.1 and maybe more. Check with strace to find out which libraries your binary file uses.
ld.so is the provided linker
gcc -Xlinker -rpath=/default/path/to/libraries -Xlinker -I/default/path/to/libraries/ld.so program.c