This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH, spu: quieten libgcc builds


> When final outputs the address of this function to the table in
> the .ctors section, reloc_diagnostic flags this as a runtime relocation.
> The symbol is always provided, and so the linker will always be able to
> resolve these at link time.

The error is complaining about run-time relocations, not link time.  The
code is being compiled with -fpic and there is currently no support for
handling relocations at run time.  Thus the error.

Hmm, I am not sure about disabling for ctors and dtors.  It is true that
currently only plugins are specified as PIC, and maybe ctors/dtors don't
make sense for plugins, but they aren't explicitly disallowed.  There are
cases of PIC being used for non-plugins already, so I am inclined not to
make this change.

I am ok with disabling the run-time relocations errors on a file by file
basis as long as the details are here on the mailing list as a record.

Trevor



                                                                           
             Ben Elliston                                                  
             <bje@au1.ibm.com>                                             
                                                                        To 
             12/07/2008 06:39          Trevor Smigiel/R&D/SCEA@Playstation 
             PM                                                         cc 
                                       gcc-patches                         
                                       <gcc-patches@gcc.gnu.org>, Andrew   
                                       Pinski/R&D/SCEA@PLAYSTATION         
                                                                   Subject 
                                       Re: PATCH, spu: quieten libgcc      
                                       builds                              
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




> Could you provide details on which libgcc functions are causing the
> messages?  And why it is ok to ignore them?

One of the functions in mfc_tag_table.c is marked with __attribute__
((constructor)), producing this warning:

mfc_tag_table.c: In function â__mfc_tag_initâ:
mfc_tag_table.c:39: warning: creating run-time relocation for
â__mfc_tag_initâ

When final outputs the address of this function to the table in
the .ctors section, reloc_diagnostic flags this as a runtime relocation.
The symbol is always provided, and so the linker will always be able to
resolve these at link time.

What about silencing the warning for constructor/destructor functions,
like so?

Index: config/spu/spu.c
===================================================================
--- config/spu/spu.c    (revision 142545)
+++ config/spu/spu.c    (working copy)
@@ -4767,6 +4767,11 @@ reloc_diagnostic (rtx x)
           && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF)
     decl = SYMBOL_REF_DECL (XEXP (XEXP (x, 0), 0));

+  /* Don't emit a warning for constructor or destructor functions.  */
+  if (decl && (DECL_STATIC_CONSTRUCTOR (decl)
+              || DECL_STATIC_DESTRUCTOR (decl)))
+    return;
+
   /* SYMBOL_REF_DECL is not necessarily a DECL. */
   if (decl && !DECL_P (decl))
     decl = 0;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]