Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug 734556 - hack clang to compensate for broken linker. r=rail.

  • Loading branch information...
commit cfe60ed0d8f4cd820bc2b134461d29625b8737eb 1 parent 06609b2
Rafael Ávila de Espíndola authored
View
6 clang/centos5-i686/clang.spec
@@ -2,9 +2,10 @@
Name: clang
Summary: clang
Version: 3.0
-Release: r%{REPO_REV}.moz0
+Release: r%{REPO_REV}.moz1
License: BSD
Group: Development/Libraries
+Patch0: old-ld-hack.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%define toplevel_dir clang-%{version}-%{release}
@@ -20,6 +21,9 @@ svn co -r %{REPO_REV} http://llvm.org/svn/llvm-project/cfe/trunk $RPM_SOURCE_DIR
svn co -r %{REPO_REV} http://llvm.org/svn/llvm-project/compiler-rt/trunk $RPM_SOURCE_DIR/compiler-rt
ln -sf ../../clang $RPM_SOURCE_DIR/llvm/tools
ln -sf ../../compiler-rt $RPM_SOURCE_DIR/llvm/projects
+cd $RPM_SOURCE_DIR/llvm
+%patch0 -p1
+cd -
mkdir -p %{toplevel_dir}
%build
View
120 clang/centos5-i686/old-ld-hack.patch
@@ -0,0 +1,120 @@
+diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h
+index 9932306..948caa8 100644
+--- a/include/llvm/MC/MCStreamer.h
++++ b/include/llvm/MC/MCStreamer.h
+@@ -116,7 +116,7 @@ namespace llvm {
+ return FrameInfos[i];
+ }
+
+- ArrayRef<MCDwarfFrameInfo> getFrameInfos() {
++ MutableArrayRef<MCDwarfFrameInfo> getFrameInfos() {
+ return FrameInfos;
+ }
+
+diff --git a/lib/MC/MCDwarf.cpp b/lib/MC/MCDwarf.cpp
+index e16f7ae..edf1d6d 100644
+--- a/lib/MC/MCDwarf.cpp
++++ b/lib/MC/MCDwarf.cpp
+@@ -859,7 +859,6 @@ namespace {
+ const MCSymbol &EmitCIE(MCStreamer &streamer,
+ const MCSymbol *personality,
+ unsigned personalityEncoding,
+- const MCSymbol *lsda,
+ bool IsSignalFrame,
+ unsigned lsdaEncoding);
+ MCSymbol *EmitFDE(MCStreamer &streamer,
+@@ -1131,7 +1130,6 @@ bool FrameEmitterImpl::EmitCompactUnwind(MCStreamer &Streamer,
+ const MCSymbol &FrameEmitterImpl::EmitCIE(MCStreamer &streamer,
+ const MCSymbol *personality,
+ unsigned personalityEncoding,
+- const MCSymbol *lsda,
+ bool IsSignalFrame,
+ unsigned lsdaEncoding) {
+ MCContext &context = streamer.getContext();
+@@ -1172,7 +1170,7 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(MCStreamer &streamer,
+ Augmentation += "z";
+ if (personality)
+ Augmentation += "P";
+- if (lsda)
++ if (lsdaEncoding)
+ Augmentation += "L";
+ Augmentation += "R";
+ if (IsSignalFrame)
+@@ -1203,7 +1201,7 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(MCStreamer &streamer,
+ // Personality
+ augmentationLength += getSizeForEncoding(streamer, personalityEncoding);
+ }
+- if (lsda)
++ if (lsdaEncoding)
+ augmentationLength += 1;
+ // Encoding of the FDE pointers
+ augmentationLength += 1;
+@@ -1221,7 +1219,7 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(MCStreamer &streamer,
+ EmitPersonality(streamer, *personality, personalityEncoding);
+ }
+
+- if (lsda)
++ if (lsdaEncoding)
+ EmitEncodingByte(streamer, lsdaEncoding, "LSDA Encoding");
+
+ // Encoding of the FDE pointers
+@@ -1322,6 +1320,8 @@ MCSymbol *FrameEmitterImpl::EmitFDE(MCStreamer &streamer,
+ if (frame.Lsda)
+ EmitSymbol(streamer, *frame.Lsda, frame.LsdaEncoding,
+ "Language Specific Data Area");
++ else if (frame.LsdaEncoding)
++ streamer.EmitIntValue(0, 4);
+ }
+
+ // Call Frame Instructions
+@@ -1385,7 +1385,7 @@ void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer,
+ MCObjectFileInfo *MOFI =
+ const_cast<MCObjectFileInfo*>(Context.getObjectFileInfo());
+ FrameEmitterImpl Emitter(UsingCFI, IsEH);
+- ArrayRef<MCDwarfFrameInfo> FrameArray = Streamer.getFrameInfos();
++ MutableArrayRef<MCDwarfFrameInfo> FrameArray = Streamer.getFrameInfos();
+
+ // Emit the compact unwind info if available.
+ if (IsEH && MOFI->getCompactUnwindSection())
+@@ -1405,7 +1405,31 @@ void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer,
+ MCSymbol *FDEEnd = NULL;
+ DenseMap<CIEKey, const MCSymbol*> CIEStarts;
+
+- const MCSymbol *DummyDebugKey = NULL;
++
++ const MCSymbol *HackPersonality = NULL;
++ unsigned HackLsdaEncoding = 0;
++ unsigned HackPersonalityEncoding = 0;
++ for (unsigned i = 0, n = FrameArray.size(); i < n; ++i) {
++ const MCDwarfFrameInfo &Frame = FrameArray[i];
++ if (!HackPersonality)
++ HackPersonality = Frame.Personality;
++ if (!HackLsdaEncoding)
++ HackLsdaEncoding = Frame.LsdaEncoding;
++ if (!HackPersonalityEncoding)
++ HackPersonalityEncoding = Frame.PersonalityEncoding;
++ }
++
++ for (unsigned i = 0, n = FrameArray.size(); i < n; ++i) {
++ MCDwarfFrameInfo &Frame = FrameArray[i];
++ assert(Frame.Personality == NULL || Frame.Personality == HackPersonality);
++ Frame.Personality = HackPersonality;
++ assert(Frame.LsdaEncoding == 0 || Frame.LsdaEncoding == HackLsdaEncoding);
++ Frame.LsdaEncoding = HackLsdaEncoding;
++ assert(Frame.PersonalityEncoding == 0 || Frame.PersonalityEncoding == HackPersonalityEncoding);
++ Frame.PersonalityEncoding = HackPersonalityEncoding;
++ }
++
++ const MCSymbol *DummyDebugKey = NULL;
+ for (unsigned i = 0, n = FrameArray.size(); i < n; ++i) {
+ const MCDwarfFrameInfo &Frame = FrameArray[i];
+ CIEKey Key(Frame.Personality, Frame.PersonalityEncoding,
+@@ -1413,7 +1437,7 @@ void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer,
+ const MCSymbol *&CIEStart = IsEH ? CIEStarts[Key] : DummyDebugKey;
+ if (!CIEStart)
+ CIEStart = &Emitter.EmitCIE(Streamer, Frame.Personality,
+- Frame.PersonalityEncoding, Frame.Lsda,
++ Frame.PersonalityEncoding,
+ Frame.IsSignalFrame,
+ Frame.LsdaEncoding);
+
Please sign in to comment.
Something went wrong with that request. Please try again.