[llvm-commits] [llvm-gcc-4.2] r65599 - in /llvm-gcc-4.2/trunk/gcc: config/darwin.h llvm-convert.cpp

Chris Lattner clattner at apple.com
Thu Feb 26 21:19:20 PST 2009


On Feb 26, 2009, at 4:50 PM, Stuart Hastings wrote:

> Author: stuart
> Date: Thu Feb 26 18:50:45 2009
> New Revision: 65599
>
> URL: http://llvm.org/viewvc/llvm-project?rev=65599&view=rev
> Log:
> Try, again, to send STRING_CSTs to the cstring section.  This is a
> followup to r65490.  Darwin-specific.

Looks great Stuart, thanks.  One minor nit-pick: theoretically this  
hook could be used for targets other than darwin.  Would it make sense  
to remove "DARWIN_" from the macro name?

Also, please apply a testcase to llvm/test/FrontendC that checks that  
the -emit-llvm output of llvm-gcc specifies the right section.  Thanks,

-Chris

>
>
> Modified:
>    llvm-gcc-4.2/trunk/gcc/config/darwin.h
>    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
>
> Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=65599&r1=65598&r2=65599&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original)
> +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Thu Feb 26 18:50:45 2009
> @@ -689,6 +689,8 @@
>   } while (0)
> /* LLVM LOCAL - end radar 6389998 */
>
> +/* Assign STRING_CSTs to the .cstring section.  */
> +#define LLVM_DARWIN_CSTRING_SECTION  
> "__TEXT,__cstring,cstring_literals"
> #endif
> /* LLVM LOCAL end */
>
>
> Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=65599&r1=65598&r2=65599&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
> +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Feb 26 18:50:45 2009
> @@ -7181,6 +7181,11 @@
>                                             TAI- 
> >getStringConstantPrefix() :
>                                             ".str", TheModule);
>   if (SlotP) *SlotP = GV;
> +#ifdef LLVM_DARWIN_CSTRING_SECTION
> +  // For Darwin, try to put it into the .cstring section.
> +  if (TAI && TAI->SectionKindForGlobal(GV) ==  
> SectionKind::RODataMergeStr)
> +    GV->setSection(LLVM_DARWIN_CSTRING_SECTION);
> +#endif
>   return GV;
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list