Someone at GNU made a bad mistake by adding a the following misfeature to gcc 2.7.0: in the absence of -R options, specify a -R option for each -L option on the commandline.
While this looks "neat" on the surface, this makes ld ignore LD_RUN_PATH, which is the mechanism used by R6 to set the RPATH. It also introduces a security hole, as it sets a relative RPATH for all X executables, including the set-uid ones.
Workaround:
remove the following bit from the gcc-lib/.../2.7.0/specs file:
%{!static:%{!R*:%{L*:-R %*}}}
then rebuild X.
This is fixed in gcc 2.7.1