This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: rs6000_flag_pic
On Wed, Mar 12, 2003 at 05:32:51PM -0500, David Edelsohn wrote:
> The current behavior is correct and necessary, not overly
> pessimistic.
Please explain. I've been using this patch for quite some time with
no apparent ill effects. The following simple example shows a case
where the current code is overly pessimistic:
$ cat > const.c <<EOF
const char *const msg = "hi!";
EOF
$ gcc64-curr/gcc/xgcc -Bgcc64-curr/gcc/ -S -O2 const.c
$ cat const.s
.file "const.c"
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "hi!"
.globl msg
.section .data.rel.ro.local,"aw",@progbits
.align 3
.type msg, @object
.size msg, 8
msg:
.quad .LC0
.ident "GCC: (GNU) 3.4 20030311 (experimental)"
$ gcc64-rs6000/gcc/xgcc -Bgcc64-rs6000/gcc/ -S -O2 const.c
$ cat const.s
.file "const.c"
.section .rodata.str1.8,"aMS",@progbits,1
.align 3
.LC0:
.string "hi!"
.globl msg
.section .rodata
.align 3
.type msg, @object
.size msg, 8
msg:
.quad .LC0
.ident "GCC: (GNU) 3.4 20030311 (experimental)"
Note the selection of a writable section for "msg" in the unpatched
(first) case.
--
Alan Modra
IBM OzLabs - Linux Technology Centre