-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSX: 'upc_pgm_info': mach-o section specifier requires a segment and section separated by a comma #6
Comments
I think the right way to solve this is to move this definition back into gcc-upc-lib.h. The only reason for the divergence from gupc is that I didn't completely understand how gupc handles it when I wrote this originally. |
I tried to push the way through this error by adding appropriate sections (__DATA) where needed. Made the following changes: diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
diff --git a/lib/CodeGen/CGStmtUPC.cpp b/lib/CodeGen/CGStmtUPC.cpp
SetCommonAttributes(D, GV);
// Emit the initializer function if necessary.
The only change that is problematic is the one in runtime/libupc/CMakeLists.txt. I am not familiar with Cmake and don;t know how to change the include based on the system it is building on. After this I was able to rebuild everything to the end. And did not run into the perl error. Which is interesting. |
On 03/04/13 17:26:18, Nenad Vukicevic wrote:
If you didn't 'make clean' or start from scratch, the .ld Try it from scratch, with the default -j switch. |
Preprocessor directives aren't really the right way to handle this, as they break cross-compilation. I don't have a mac to test with, but I'll try to put something together today. |
It looks like we forgot one change that made some tests fail on Mac OS: diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index ca5bf3a..d703484 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -458,7 +458,10 @@ void CodeGenModule::EmitUPCInits(const CtorList &Fns, const char *Globa
llvm::GlobalValue::AppendingLinkage,
llvm::ConstantArray::get(AT, Ctors),
GlobalName);
- GV->setSection("upc_init_array");
+ if(isTargetDarwin())
+ GV->setSection("__DATA,upc_init_array");
+ else
+ GV->setSection("upc_init_array");
}
} |
This patch looks fine. Please commit it. |
…ase ctor in window. Need add "complete object flag" check in eh cleanup code. The problem only happen on window ( A MS-ABI issuer ) The nature of the problem is virtual base dtor called more than it is needed after exception throw in inheriting base class(with virtual bases) ctor. The root problem is when throw happen, not all virtual base classes have been contructed, so not all virtual base dtors are need to call for ehcleanup. clang has code to handle vbase initialization: basically add check for "complete object flag" before call to v-base ctor. But that part is missing for cleanup code. To fix this add similar code as v-base init to cleanup code, same algorithm. 1> Add new routine: EmitDtorCompleteObjectHandler With corresponding to EmitCtorCompleteObjectHandler 2> In the EmitDestructorCal Call EmitDtorCompleteObjectHandler when generate ehcleanup inside ctor. Just add check for "complete object flag" before call to v-base dtor. Without my change: ehcleanup: ; preds = %ctor.skip_vbases %13 = cleanuppad within none [], !dbg !66 %14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66 %15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66 %16 = bitcast i8* %15 to %struct.class_2*, !dbg !66 call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token %13) ], !dbg !66 cleanupret from %13 unwind to caller, !dbg !66 with my change: ehcleanup: ; preds = %ctor.skip_vbases %13 = cleanuppad within none [], !dbg !66 %14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66 %15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66 %16 = bitcast i8* %15 to %struct.class_2*, !dbg !66 %is_complete_object4 = icmp ne i32 %is_most_derived2, 0, !dbg !66 br i1 %is_complete_object4, label %Dtor.dtor_vbase, label %Dtor.skip_vbase, !d bg !66 Dtor.dtor_vbase: ; preds = %ehcleanup call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token %13) ], !dbg !66 br label %Dtor.skip_vbase, !dbg !66 Dtor.skip_vbase: ; preds = %Dtor.dtor_vbase, %ehcleanup cleanupret from %13 unwind to caller, !dbg !66 Please let me know you need more info. Patch by Jennifer Yu. Differential Revision: https://reviews.llvm.org/D27358 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288869 91177308-0d34-0410-b5e6-96231b3b80d8
On Macos/Darwin, the make fails with
fatal error: error in backend: Global variable 'GCCUPCConfig' has an invalid
section specifier 'upc_pgm_info': mach-o section specifier requires a
segment and section separated by a comma.
This GCCUPCConfig variable is generated by this section of code.
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 9a55c08..895d80b 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
[...]
void CodeGenModule::Release() {
Note the "setSection" call above.
This small test program indicates the expected section name syntax on a Mach OS based system.
static const char GCCUPCConfig[]
if MACH
attribute ((section("DATA,upc_pgm_info"))) __attribute ((used)) =
else
attribute ((section("upc_pgm_info"))) attribute ((used)) =
endif
"$GCCUPCConfig: (" BASE_FILE ") " "$";
int main(void)
{
return 0;
}
I think that the lack of the ""__DATA,upc_pgm_info" syntax might be the source of the problem, but am unsure how this might be best parametrized within the compiler. Perhaps there is already some mechanism to achieve this OS dependent behavior?
The text was updated successfully, but these errors were encountered: