Chromium Code Reviews| Index: lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp |
| diff --git a/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp b/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp |
| index 2c155aaf40dde487d467941d6f5bbb3e0cec5962..27c49b845dc09b9bb80dc0612fd0f8cd5efc921b 100644 |
| --- a/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp |
| +++ b/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp |
| @@ -19,11 +19,14 @@ |
| #include "InstPrinter/ARMInstPrinter.h" |
| #include "llvm/ADT/Triple.h" |
| #include "llvm/MC/MCCodeGenInfo.h" |
| +#include "llvm/MC/MCContext.h" |
| #include "llvm/MC/MCInstrAnalysis.h" |
| #include "llvm/MC/MCInstrInfo.h" |
| #include "llvm/MC/MCRegisterInfo.h" |
| +#include "llvm/MC/MCSectionELF.h" |
| #include "llvm/MC/MCStreamer.h" |
| #include "llvm/MC/MCSubtargetInfo.h" |
| +#include "llvm/Support/ELF.h" |
| #include "llvm/Support/ErrorHandling.h" |
| #include "llvm/Support/TargetRegistry.h" |
| @@ -211,8 +214,30 @@ static MCStreamer *createMCStreamer(const Target &T, StringRef TT, |
| // @LOCALMOD-BEGIN |
| MCStreamer *Streamer = createARMELFStreamer(Ctx, MAB, OS, Emitter, false, |
| NoExecStack, TheTriple.getArch() == Triple::thumb); |
| - if (TheTriple.isOSNaCl()) |
| + if (TheTriple.isOSNaCl()) { |
| Streamer->EmitBundleAlignMode(4); |
| + const char *NoteName = ".note.NaCl.ABI.arm"; |
|
Mark Seaborn
2013/05/09 21:54:11
Since this is duplicated between ARM/x86 (and does
eliben
2013/05/09 21:54:59
Why not:
const char NoteName[] = "...."
And then
Derek Schuff
2013/05/10 18:35:30
I didn't end up with a named const char array for
|
| + const char *NoteNamespace = "NaCl"; |
| + const char *NoteArch = "arm"; |
| + const MCSection *Note = Ctx.getELFSection( |
| + NoteName, ELF::SHT_NOTE, ELF::SHF_ALLOC | ELF::SHF_GROUP, |
| + SectionKind::getReadOnly(), 0, NoteName); |
| + |
| + Streamer->reset(); |
| + // maybe should use pushSection and popSection but popSection will crash if |
|
Mark Seaborn
2013/05/09 21:54:11
'maybe' -> 'Maybe'. Make this a TODO?
Derek Schuff
2013/05/10 18:35:30
Done.
|
| + // there haven't been any other sections switched to yet. |
| + Streamer->SwitchSection(Note); |
| + Streamer->EmitIntValue(5, 4); // sizeof("NaCl") |
|
Mark Seaborn
2013/05/09 21:54:11
Use strlen(NoteNamespace)
Derek Schuff
2013/05/10 18:35:30
Done.
|
| + Streamer->EmitIntValue(4, 4); // sizeof("arm") |
|
Mark Seaborn
2013/05/09 21:54:11
ditto
Derek Schuff
2013/05/10 18:35:30
Done.
|
| + Streamer->EmitIntValue(1, 4); // NT_VERSION |
|
Mark Seaborn
2013/05/09 21:54:11
Can you #define this in Support/ELF.h?
Derek Schuff
2013/05/10 18:35:30
I could. I'm actually not sure if this is 1 becaus
Mark Seaborn
2013/05/10 19:52:45
It's NT_VERSION. See gold/nacl.h in binutils:
Derek Schuff
2013/05/10 22:59:26
Done.
|
| + Streamer->EmitValueToAlignment(4); |
| + Streamer->EmitBytes(NoteNamespace); |
| + Streamer->EmitIntValue(0, 1); // NUL terminator |
| + Streamer->EmitValueToAlignment(4); |
| + Streamer->EmitBytes(NoteArch); |
| + Streamer->EmitIntValue(0, 1); // NUL terminator |
| + Streamer->EmitValueToAlignment(4); |
| + } |
| return Streamer; |
| // @LOCALMOD-END |
| } |