Impure text in code from -fpic, egcs-1.1.2

John Polstra jdp@polstra.com
Thu Apr 8 12:06:00 GMT 1999


Attached is a test case that, even when compiled with "-fpic",
requires a relocation in the text segment -- in the ".rodata"
section, to be precise.

cc --version says "egcs-2.91.66".

uname -a says: FreeBSD blake.polstra.com 4.0-CURRENT FreeBSD 4.0-CURRENT #1: Mon Apr  5 11:59:00 PDT 1999     jdp@blake.polstra
.com:/usr/src/sys/compile/BLAKE  i386

The command line for compiling the test case is: cc -fpic -O -c k_standard.i

If you change the "-c" to "-S" you will find this in the .rodata
section of the assembly output:

        .LC71:
                .long __sF+176

Since __sF is an external symbol, this .long requires relocation at
run-time, making the text segment impure.

John
---
  John Polstra                                               jdp@polstra.com
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Self-interest is the aphrodisiac of belief."           -- James V. DeLong



More information about the Gcc-bugs mailing list