[Bug c/57260] New: Generated R_MIPS_GOT_MIPS relocation for direct function call while compiling with -O2 on MIPS N64

lee.duhem at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon May 13 07:01:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57260

            Bug ID: 57260
           Summary: Generated R_MIPS_GOT_MIPS relocation for direct
                    function call while compiling with -O2 on MIPS N64
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lee.duhem at gmail dot com

Created attachment 30101
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30101&action=edit
includes glxdri.c, glxdri.xgcc.O0.s and glxdri.xgcc.O2.s

If glxdri.c, which is part of Xorg source, is compiled by 
gcc with -O2, R_MIPS_GOT_DISP relocations will be generated 
for two direct function calls, DRIBlockHandler and DRIWakeupHandler.
While Xorg loads the libglx.so that is generated by using glxdri.o
and other object files, dlopen will give error message which says
'undefined symbol: DRIBlockHandler'. 

If glxdri.c is compiled by gcc with -O0, all the relocations
for both DRIBlockHandler and DRIWakeupHandler are R_MIPS_CALL16,
this time the libglx.so will be loaded correctly by dlopen.

In the -O2 case, is the relocation type for DRIBlockHandler and
DRIWakeupHandler correct?

Just for your information, here is the glxdir.c compiling command
(default ABI is MIPS N64):

~/gcc/build0/gcc/xgcc -B ~/gcc/build0/gcc/ -std=gnu99 -DHAVE_CONFIG_H -I.
-I../include -I../hw/xfree86/os-support -I../hw/xfree86/os-support/bus
-I../hw/xfree86/common -I../hw/xfree86/dri -I../mi -I../hw/xfree86/dri2
-DHAVE_DIX_CONFIG_H -Wall -Wpointer-arith -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs
-fno-strict-aliasing -Wbad-function-cast -Wformat=2 -Wold-style-definition
-Wdeclaration-after-statement -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT
-I/usr/include/freetype2 -I/usr/include/pixman-1 -I../include -I../include
-I../Xext -I../composite -I../damageext -I../xfixes -I../Xi -I../mi
-I../miext/sync -I../miext/shadow -I../miext/damage -I../render -I../randr
-I../fb -fvisibility=hidden -I/usr/include/libdrm -I/usr/include/libdrm
-I/usr/include/libdrm -I/usr/include/X11/dri -DXFree86Server -DGLX_USE_TLS
-DPTHREADS -O2 -g -Wl,-z,relro -fno-strict-aliasing -MT glxdri.lo -MD -MP -MF
.deps/glxdri.Tpo -S glxdri.c  -fPIC -DPIC -o .libs/glxdri.xgcc.O2.s



More information about the Gcc-bugs mailing list