[llvm-commits] [llvm-gcc-4.2] r42213 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Devang Patel
dpatel at apple.com
Fri Sep 21 16:15:24 PDT 2007
Author: dpatel
Date: Fri Sep 21 18:15:24 2007
New Revision: 42213
URL: http://llvm.org/viewvc/llvm-project?rev=42213&view=rev
Log:
Now, DECL_SECTION_NAME is not appropriate for const_decl.
This fixes PR1653 crash.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=42213&r1=42212&r2=42213&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Fri Sep 21 18:15:24 2007
@@ -855,7 +855,7 @@
}
// Set the section for the global.
- if (TREE_CODE(decl) == VAR_DECL || TREE_CODE(decl) == CONST_DECL) {
+ if (TREE_CODE(decl) == VAR_DECL) {
if (DECL_SECTION_NAME(decl)) {
GV->setSection(TREE_STRING_POINTER(DECL_SECTION_NAME(decl)));
#ifdef LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION
@@ -864,6 +864,15 @@
GV->setSection(Section);
#endif
}
+#ifdef LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION
+ else if (TREE_CODE(decl) == CONST_DECL) {
+ if (const char *Section =
+ LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION(decl)) {
+ GV->setSection(Section);
+ }
+ }
+#endif
+
// Set the alignment for the global if one of the following condition is met
// 1) DECL_ALIGN_UNIT does not match alignment as per ABI specification
More information about the llvm-commits
mailing list