This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
analysis: arch=i686, -fPIC won't play nice on OSR5
- To: egcs at cygnus dot com
- Subject: analysis: arch=i686, -fPIC won't play nice on OSR5
- From: Robert Lipe <robertl at dgii dot com>
- Date: Mon, 29 Jun 1998 22:52:42 -0500
- Cc: jpr at jpr dot com
- References: <19980618145503.L4401@dgii.com>
This is my first venture into i386.c and the land of RTL, so please be
gentle. I think I have a solution for this problem, but I'd like input
from the folks that actually understand what's going on in here before I
actually submit a patch.
Summarized, the SCO ELF assembler howls if you give a ".type
blah,function" to a non-global label. (I assume this is becuase
it knows that it's silly to try to stick debugging info onto a label
that won't be seen by the debugger.)
I poked around in i386.c and found asm_output_function_prefix() has
a test that looks like it'll only light up on P6 (which includes
my pentium-II) and for PIC. This exactly describes the test
cases I hit below, so I figured I was on the right path. After
calling gen_label_rtx() and ASM_GENERATE_INTERNAL_LABEL(), it calls
ASM_DECLARE_FUNCTION_NAME(). This results in the debugging info
(.type) being spat out. For an internal label, is this really
desirable? I just replaced the
#ifdef ASM_DECLARE_FUNCTION_NAME
ASM_DECLARE_FUNCTION_NAME(file, pic_label_name,prologue_node)
#endif
with
ASM_OUTPUT_LABEL (file, pic_label_name);
and a quick test on both OpenServer and RH5.1 of:
make -k check-g77 RUNTESTFLAGS="--target_board 'unix{-fPIC,}'"
give consistent results for the pic and pic-not cases on each OS with no
additional failures noted on Linux, where this problem didn't show up.
If this sounds like the right solution, let me know and I'll do the
patch thing.
Thanx,
RJL
Robert Lipe wrote:
> I won't bother with the full testsuite results becuase they're so noisy
> as to be uninteresting. Here's the punchline.
>
> $ cat /tmp/x.c
> main()
> {
> exit(0);
> }
>
> foo(){}
>
> $ ./xgcc -march=i586 -B./ -fPIC /tmp/x.c
> (robertl) rjlhome:/play/negcs/gcc
> $ ./xgcc -march=i686 -B./ -fPIC /tmp/x.c
> (EOF):useless specification of size and/or type for name: .LPR0
>
>
> Let's look at the generated code:
>
> $ ./xgcc -march=i686 -B./ -fPIC -S /tmp/x.c
> (robertl) rjlhome:/play/negcs/gcc
> $ head x.s
> .file "x.c"
> .version "01.01"
> gcc2_compiled.:
> __gnu_compiled_c:
> .text
> .align 4
> .type .LPR0,@function
> .LPR0:
> movl (%esp),%ebx
> ret
>
>
> Since the label .LPR0 isn't global, the SCO assembler is squawking about
> it having a debugging type. If I insert '.globl .LPR0' it assembles.
> If I change all occurrences of '.LPR0' to 'LPR0' it assembles.
>
>
> For some reason, this particular sequence of events is unique (?) to
> -fPIC and -march=i686. The Linux GNU assembler that I tested (the one
> on RH5.1) doesn't seem to mind this construct.
>
> I just tested 1.0.3 with the same source and command line invocation as
> above, and it worked. I can't pinpoint an exact breaking point between
> there and here since this is my first P6 build.
>
> Any ideas?
>
>
> RJL
--
Robert Lipe http://www.dgii.com/people/robertl robertl@dgii.com
(WEB ADDRESS MAY BE TEMPORARILY UNAVAILABLE)