* Re: ppc problem with .rodata.str1.4. binutils requirement for gcc 3.3.1? @ 2003-11-28 18:21 Kris Warkentin 0 siblings, 0 replies; 10+ messages in thread From: Kris Warkentin @ 2003-11-28 18:21 UTC (permalink / raw) To: binutils I asked this on the gcc mailing list but they suggested to ask binutils. In the course of building some powerpc startup code we found ld complaining about "allocated section `.rodata.str1.4' not in segment" and "allocated section `.eh_frame' not in segment". I observed that some of the objects in the startup had .rodata.str1.4 sections in them. I also observed that if I took the ld from binutils 2.12.1 to 2.14, the problem went away. I didn't find any talk of a hard binutils requirement for the 3.3 series of gcc but perhaps I missed it. Can anyone shed some light on this? I hope I'm not too astonishing in my ignorance but this .rodata.str1.x doesn't seem to be generated by our older gcc and I don't really know what the significance of it all is. Essentially we're in the middle of a release and are stuck at our current gcc and binutils versions for the moment so if anyone can give me an idea of how to understand/work around the problem, I'd be very grateful. cheers, Kris ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <087e01c3b5da$77d658e0$0202040a@catdog>]
* Re: ppc problem with .rodata.str1.4. binutils requirement for gcc 3.3.1? [not found] <087e01c3b5da$77d658e0$0202040a@catdog> @ 2003-11-29 1:42 ` Alan Modra 2003-11-29 18:14 ` Kris Warkentin [not found] ` <amodra@bigpond.net.au> 0 siblings, 2 replies; 10+ messages in thread From: Alan Modra @ 2003-11-29 1:42 UTC (permalink / raw) To: Kris Warkentin; +Cc: Gcc ML, binutils On Fri, Nov 28, 2003 at 01:07:21PM -0500, Kris Warkentin wrote: > In the course of building some powerpc startup code we found ld complaining > about "allocated section `.rodata.str1.4' not in segment" and "allocated > section `.eh_frame' not in segment". I observed that some of the objects in > the startup had .rodata.str1.4 sections in them. I also observed that if I > took the ld from binutils 2.12.1 to 2.14, the problem went away. This is very likely a bug in gcc. I reckon that if you look at your object file with readelf or objdump, you'll find that this .rodata section is marked read/write. The fix is easy. --- gcc-ppc64-33.orig/gcc/config/rs6000/rs6000.c 2003-09-27 10:07:41.000000000 +0930 +++ gcc-ppc64-33/gcc/config/rs6000/rs6000.c 2003-11-29 12:04:22.000000000 +1030 @@ -13138,14 +13659,8 @@ rs6000_elf_section_type_flags (decl, nam const char *name; int reloc; { - unsigned int flags - = default_section_type_flags_1 (decl, name, reloc, - flag_pic || DEFAULT_ABI == ABI_AIX); - - if (TARGET_RELOCATABLE) - flags |= SECTION_WRITE; - - return flags; + return default_section_type_flags_1 (decl, name, reloc, + flag_pic || DEFAULT_ABI == ABI_AIX); } /* Record an element in the table of global constructors. SYMBOL is > I didn't find any talk of a hard binutils requirement for the 3.3 series of > gcc but perhaps I missed it. Can anyone shed some light on this? I hope > I'm not too astonishing in my ignorance but this .rodata.str1.x doesn't seem > to be generated by our older gcc and I don't really know what the > significance of it all is. Sections like .rodata.str1.4 are generated by gcc to support merging of duplicate constants and strings by ld. Older gcc's won't do this, nor will a newer gcc built for a system without the requisite ld support. -- Alan Modra IBM OzLabs - Linux Technology Centre ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ppc problem with .rodata.str1.4. binutils requirement for gcc 3.3.1? 2003-11-29 1:42 ` Alan Modra @ 2003-11-29 18:14 ` Kris Warkentin [not found] ` <amodra@bigpond.net.au> 1 sibling, 0 replies; 10+ messages in thread From: Kris Warkentin @ 2003-11-29 18:14 UTC (permalink / raw) To: Alan Modra; +Cc: Gcc ML, binutils Interesting. So it might be an issue with gcc but it looks like the linker can deal with it. On our end, it actually turned out that the process that was spawning ld (our bootable image generator) was using a special link script that wasn't taking into account the presence of these sections. When we put them into the link script, the warnings went away and the image could boot. Thanks very much for the help. I'll try out your patch and see if it cleans up our objects for us. cheers, Kris ----- Original Message ----- From: "Alan Modra" <amodra@bigpond.net.au> To: "Kris Warkentin" <kewarken@qnx.com> Cc: "Gcc ML" <gcc@gcc.gnu.org>; <binutils@sources.redhat.com> Sent: Friday, November 28, 2003 8:42 PM Subject: Re: ppc problem with .rodata.str1.4. binutils requirement for gcc 3.3.1? > On Fri, Nov 28, 2003 at 01:07:21PM -0500, Kris Warkentin wrote: > > In the course of building some powerpc startup code we found ld complaining > > about "allocated section `.rodata.str1.4' not in segment" and "allocated > > section `.eh_frame' not in segment". I observed that some of the objects in > > the startup had .rodata.str1.4 sections in them. I also observed that if I > > took the ld from binutils 2.12.1 to 2.14, the problem went away. > > This is very likely a bug in gcc. I reckon that if you look at your > object file with readelf or objdump, you'll find that this .rodata > section is marked read/write. > > The fix is easy. > > --- gcc-ppc64-33.orig/gcc/config/rs6000/rs6000.c 2003-09-27 10:07:41.000000000 +0930 > +++ gcc-ppc64-33/gcc/config/rs6000/rs6000.c 2003-11-29 12:04:22.000000000 +1030 > @@ -13138,14 +13659,8 @@ rs6000_elf_section_type_flags (decl, nam > const char *name; > int reloc; > { > - unsigned int flags > - = default_section_type_flags_1 (decl, name, reloc, > - flag_pic || DEFAULT_ABI == ABI_AIX); > - > - if (TARGET_RELOCATABLE) > - flags |= SECTION_WRITE; > - > - return flags; > + return default_section_type_flags_1 (decl, name, reloc, > + flag_pic || DEFAULT_ABI == ABI_AIX); > } > > /* Record an element in the table of global constructors. SYMBOL is > > > > I didn't find any talk of a hard binutils requirement for the 3.3 series of > > gcc but perhaps I missed it. Can anyone shed some light on this? I hope > > I'm not too astonishing in my ignorance but this .rodata.str1.x doesn't seem > > to be generated by our older gcc and I don't really know what the > > significance of it all is. > > Sections like .rodata.str1.4 are generated by gcc to support merging of > duplicate constants and strings by ld. Older gcc's won't do this, nor > will a newer gcc built for a system without the requisite ld support. > > -- > Alan Modra > IBM OzLabs - Linux Technology Centre > ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <amodra@bigpond.net.au>]
* Re: ppc problem with .rodata.str1.4. binutils requirement for gcc 3.3.1? [not found] ` <amodra@bigpond.net.au> @ 2003-11-29 2:33 ` David Edelsohn 2003-11-29 3:05 ` Alan Modra 2003-11-29 4:06 ` David Edelsohn 2003-11-29 19:40 ` David Edelsohn 2 siblings, 1 reply; 10+ messages in thread From: David Edelsohn @ 2003-11-29 2:33 UTC (permalink / raw) To: Kris Warkentin, Gcc ML, binutils >>>>> Alan Modra writes: Alan> This is very likely a bug in gcc. I reckon that if you look at your Alan> object file with readelf or objdump, you'll find that this .rodata Alan> section is marked read/write. Alan> The fix is easy. Alan> --- gcc-ppc64-33.orig/gcc/config/rs6000/rs6000.c 2003-09-27 10:07:41.000000000 +0930 Alan> +++ gcc-ppc64-33/gcc/config/rs6000/rs6000.c 2003-11-29 12:04:22.000000000 +1030 Alan> @@ -13138,14 +13659,8 @@ rs6000_elf_section_type_flags (decl, nam Alan> const char *name; Alan> int reloc; Alan> { Alan> - unsigned int flags Alan> - = default_section_type_flags_1 (decl, name, reloc, Alan> - flag_pic || DEFAULT_ABI == ABI_AIX); Alan> - Alan> - if (TARGET_RELOCATABLE) Alan> - flags |= SECTION_WRITE; Alan> - Alan> - return flags; Alan> + return default_section_type_flags_1 (decl, name, reloc, Alan> + flag_pic || DEFAULT_ABI == ABI_AIX); Alan> } Alan> /* Record an element in the table of global constructors. SYMBOL is I am not sure that we can make this change unilaterally. The addition of the SECTION_WRITE flag may be necessary for embedded targets. We need to understand the reason for the feature before removing it. David ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ppc problem with .rodata.str1.4. binutils requirement for gcc 3.3.1? 2003-11-29 2:33 ` David Edelsohn @ 2003-11-29 3:05 ` Alan Modra 0 siblings, 0 replies; 10+ messages in thread From: Alan Modra @ 2003-11-29 3:05 UTC (permalink / raw) To: David Edelsohn; +Cc: Kris Warkentin, Gcc ML, binutils On Fri, Nov 28, 2003 at 09:32:25PM -0500, David Edelsohn wrote: > I am not sure that we can make this change unilaterally. The > addition of the SECTION_WRITE flag may be necessary for embedded targets. > We need to understand the reason for the feature before removing it. See the thread starting with http://gcc.gnu.org/ml/gcc-patches/2003-10/msg01516.html -- Alan Modra IBM OzLabs - Linux Technology Centre ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ppc problem with .rodata.str1.4. binutils requirement for gcc 3.3.1? [not found] ` <amodra@bigpond.net.au> 2003-11-29 2:33 ` David Edelsohn @ 2003-11-29 4:06 ` David Edelsohn 2003-11-29 4:10 ` Andrew Pinski 2003-11-29 19:40 ` David Edelsohn 2 siblings, 1 reply; 10+ messages in thread From: David Edelsohn @ 2003-11-29 4:06 UTC (permalink / raw) To: Kris Warkentin, Gcc ML, binutils >>>>> Alan Modra writes: Alan> See the thread starting with Alan> http://gcc.gnu.org/ml/gcc-patches/2003-10/msg01516.html Okay, how about the following patch. David Index: eabi.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/rs6000/eabi.h,v retrieving revision 1.11 diff -c -p -r1.11 eabi.h *** eabi.h 10 Jun 2003 16:01:39 -0000 1.11 --- eabi.h 29 Nov 2003 04:03:02 -0000 *************** *** 55,57 **** --- 55,60 ---- #define TARGET_E500 (rs6000_cpu == PROCESSOR_PPC8540) #define TARGET_ISEL rs6000_isel #define TARGET_FPRS (!rs6000_float_gprs) + + /* Generate entries in .fixup for relocatable addresses. */ + #define RELOCATABLE_NEEDS_FIXUP Index: rs6000.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v retrieving revision 1.550 diff -c -p -r1.550 rs6000.c *** rs6000.c 14 Nov 2003 20:05:34 -0000 1.550 --- rs6000.c 29 Nov 2003 04:03:02 -0000 *************** toc_section (void) *** 14991,15002 **** static unsigned int rs6000_elf_section_type_flags (tree decl, const char *name, int reloc) { ! unsigned int flags ! = default_section_type_flags_1 (decl, name, reloc, ! flag_pic || DEFAULT_ABI == ABI_AIX); ! if (TARGET_RELOCATABLE) ! flags |= SECTION_WRITE; return flags; } --- 14991,15006 ---- static unsigned int rs6000_elf_section_type_flags (tree decl, const char *name, int reloc) { ! int rw_relocs = flag_pic || DEFAULT_ABI == ABI_AIX; ! unsigned int flags; ! ! #ifdef RELOCATABLE_NEEDS_FIXUP if (TARGET_RELOCATABLE) ! rw_relocs = 1; ! #endif ! ! flags = default_section_type_flags_1 (decl, name, reloc, ! flag_pic || DEFAULT_ABI == ABI_AIX); return flags; } Index: sysv4.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/rs6000/sysv4.h,v retrieving revision 1.142 diff -c -p -r1.142 sysv4.h *** sysv4.h 18 Nov 2003 12:56:44 -0000 1.142 --- sysv4.h 29 Nov 2003 04:03:02 -0000 *************** ncrtn.o%s" *** 1346,1351 **** #define TARGET_ASM_EXCEPTION_SECTION readonly_data_section #define DOUBLE_INT_ASM_OP "\t.quad\t" - - /* Generate entries in .fixup for relocatable addresses. */ - #define RELOCATABLE_NEEDS_FIXUP --- 1346,1348 ---- ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ppc problem with .rodata.str1.4. binutils requirement for gcc 3.3.1? 2003-11-29 4:06 ` David Edelsohn @ 2003-11-29 4:10 ` Andrew Pinski 2003-11-29 4:20 ` David Edelsohn 0 siblings, 1 reply; 10+ messages in thread From: Andrew Pinski @ 2003-11-29 4:10 UTC (permalink / raw) To: David Edelsohn; +Cc: binutils, Gcc ML, Andrew Pinski, Kris Warkentin On Nov 28, 2003, at 20:06, David Edelsohn wrote: > ! flag_pic || DEFAULT_ABI == ABI_AIX); except this should be rw_relocs instead. Thanks, Andrew Pinski ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ppc problem with .rodata.str1.4. binutils requirement for gcc 3.3.1? 2003-11-29 4:10 ` Andrew Pinski @ 2003-11-29 4:20 ` David Edelsohn 2003-11-29 6:47 ` Alan Modra 0 siblings, 1 reply; 10+ messages in thread From: David Edelsohn @ 2003-11-29 4:20 UTC (permalink / raw) To: Andrew Pinski; +Cc: binutils, Gcc ML, Kris Warkentin Corrected patch. Index: eabi.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/rs6000/eabi.h,v retrieving revision 1.11 diff -c -p -r1.11 eabi.h *** eabi.h 10 Jun 2003 16:01:39 -0000 1.11 --- eabi.h 29 Nov 2003 04:19:16 -0000 *************** *** 55,57 **** --- 55,60 ---- #define TARGET_E500 (rs6000_cpu == PROCESSOR_PPC8540) #define TARGET_ISEL rs6000_isel #define TARGET_FPRS (!rs6000_float_gprs) + + /* Generate entries in .fixup for relocatable addresses. */ + #define RELOCATABLE_NEEDS_FIXUP Index: rs6000.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v retrieving revision 1.550 diff -c -p -r1.550 rs6000.c *** rs6000.c 14 Nov 2003 20:05:34 -0000 1.550 --- rs6000.c 29 Nov 2003 04:19:17 -0000 *************** toc_section (void) *** 14991,15002 **** static unsigned int rs6000_elf_section_type_flags (tree decl, const char *name, int reloc) { ! unsigned int flags ! = default_section_type_flags_1 (decl, name, reloc, ! flag_pic || DEFAULT_ABI == ABI_AIX); ! if (TARGET_RELOCATABLE) ! flags |= SECTION_WRITE; return flags; } --- 14991,15005 ---- static unsigned int rs6000_elf_section_type_flags (tree decl, const char *name, int reloc) { ! int rw_relocs = flag_pic || DEFAULT_ABI == ABI_AIX; ! unsigned int flags; ! ! #ifdef RELOCATABLE_NEEDS_FIXUP if (TARGET_RELOCATABLE) ! rw_relocs = 1; ! #endif ! ! flags = default_section_type_flags_1 (decl, name, reloc, rw_relocs); return flags; } Index: sysv4.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/rs6000/sysv4.h,v retrieving revision 1.142 diff -c -p -r1.142 sysv4.h *** sysv4.h 18 Nov 2003 12:56:44 -0000 1.142 --- sysv4.h 29 Nov 2003 04:19:17 -0000 *************** ncrtn.o%s" *** 1346,1351 **** #define TARGET_ASM_EXCEPTION_SECTION readonly_data_section #define DOUBLE_INT_ASM_OP "\t.quad\t" - - /* Generate entries in .fixup for relocatable addresses. */ - #define RELOCATABLE_NEEDS_FIXUP --- 1346,1348 ---- ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ppc problem with .rodata.str1.4. binutils requirement for gcc 3.3.1? 2003-11-29 4:20 ` David Edelsohn @ 2003-11-29 6:47 ` Alan Modra 0 siblings, 0 replies; 10+ messages in thread From: Alan Modra @ 2003-11-29 6:47 UTC (permalink / raw) To: David Edelsohn; +Cc: Andrew Pinski, binutils, Gcc ML, Kris Warkentin On Fri, Nov 28, 2003 at 11:20:03PM -0500, David Edelsohn wrote: > Corrected patch. Geoff analyzed the problem enough to see that TARGET_RELOCATABLE implies flag_pic == 2, so there's no need for any special hacks. See http://gcc.gnu.org/ml/gcc-patches/2003-10/msg01575.html -- Alan Modra IBM OzLabs - Linux Technology Centre ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ppc problem with .rodata.str1.4. binutils requirement for gcc 3.3.1? [not found] ` <amodra@bigpond.net.au> 2003-11-29 2:33 ` David Edelsohn 2003-11-29 4:06 ` David Edelsohn @ 2003-11-29 19:40 ` David Edelsohn 2 siblings, 0 replies; 10+ messages in thread From: David Edelsohn @ 2003-11-29 19:40 UTC (permalink / raw) To: Andrew Pinski, binutils, Gcc ML, Kris Warkentin >>>>> Alan Modra writes: Alan> Geoff analyzed the problem enough to see that TARGET_RELOCATABLE Alan> implies flag_pic == 2, so there's no need for any special hacks. Alan> See http://gcc.gnu.org/ml/gcc-patches/2003-10/msg01575.html Okay, go ahead and apply you patch to rs6000_elf_section_type_flags(). We may still want to move RELOCATABLE_NEEDS_FIXUP from sysv4.h to eabi.h. David ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2003-11-29 19:40 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-11-28 18:21 ppc problem with .rodata.str1.4. binutils requirement for gcc 3.3.1? Kris Warkentin [not found] <087e01c3b5da$77d658e0$0202040a@catdog> 2003-11-29 1:42 ` Alan Modra 2003-11-29 18:14 ` Kris Warkentin [not found] ` <amodra@bigpond.net.au> 2003-11-29 2:33 ` David Edelsohn 2003-11-29 3:05 ` Alan Modra 2003-11-29 4:06 ` David Edelsohn 2003-11-29 4:10 ` Andrew Pinski 2003-11-29 4:20 ` David Edelsohn 2003-11-29 6:47 ` Alan Modra 2003-11-29 19:40 ` David Edelsohn
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).