Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: tools/llvm-mc/llvm-mc.cpp

Issue 15067009: LLVM: Add ELF Note section to NaCl object files identifying them as such to gold (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: reviews, and add initialization to llvm-mc Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« include/llvm/Support/ELF.h ('K') | « test/MC/X86/elf-note-nacl.ll ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===-- llvm-mc.cpp - Machine Code Hacking Driver -------------------------===// 1 //===-- llvm-mc.cpp - Machine Code Hacking Driver -------------------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This utility is a simple driver that allows command line hacking on machine 10 // This utility is a simple driver that allows command line hacking on machine
11 // code. 11 // code.
12 // 12 //
13 //===----------------------------------------------------------------------===// 13 //===----------------------------------------------------------------------===//
14 14
15 #include "Disassembler.h" 15 #include "Disassembler.h"
16 #include "llvm/ADT/OwningPtr.h" 16 #include "llvm/ADT/OwningPtr.h"
17 #include "llvm/MC/MCAsmBackend.h" 17 #include "llvm/MC/MCAsmBackend.h"
18 #include "llvm/MC/MCAsmInfo.h" 18 #include "llvm/MC/MCAsmInfo.h"
19 #include "llvm/MC/MCCodeEmitter.h" 19 #include "llvm/MC/MCCodeEmitter.h"
20 #include "llvm/MC/MCContext.h" 20 #include "llvm/MC/MCContext.h"
21 #include "llvm/MC/MCInstPrinter.h" 21 #include "llvm/MC/MCInstPrinter.h"
22 #include "llvm/MC/MCInstrInfo.h" 22 #include "llvm/MC/MCInstrInfo.h"
23 #include "llvm/MC/MCNaCl.h"
23 #include "llvm/MC/MCObjectFileInfo.h" 24 #include "llvm/MC/MCObjectFileInfo.h"
24 #include "llvm/MC/MCParser/AsmLexer.h" 25 #include "llvm/MC/MCParser/AsmLexer.h"
25 #include "llvm/MC/MCRegisterInfo.h" 26 #include "llvm/MC/MCRegisterInfo.h"
26 #include "llvm/MC/MCSectionMachO.h" 27 #include "llvm/MC/MCSectionMachO.h"
27 #include "llvm/MC/MCStreamer.h" 28 #include "llvm/MC/MCStreamer.h"
28 #include "llvm/MC/MCSubtargetInfo.h" 29 #include "llvm/MC/MCSubtargetInfo.h"
29 #include "llvm/MC/MCTargetAsmParser.h" 30 #include "llvm/MC/MCTargetAsmParser.h"
30 #include "llvm/MC/SubtargetFeature.h" 31 #include "llvm/MC/SubtargetFeature.h"
31 #include "llvm/Support/CommandLine.h" 32 #include "llvm/Support/CommandLine.h"
32 #include "llvm/Support/FileUtilities.h" 33 #include "llvm/Support/FileUtilities.h"
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 447
447 } else if (FileType == OFT_Null) { 448 } else if (FileType == OFT_Null) {
448 Str.reset(createNullStreamer(Ctx)); 449 Str.reset(createNullStreamer(Ctx));
449 } else { 450 } else {
450 assert(FileType == OFT_ObjectFile && "Invalid file type!"); 451 assert(FileType == OFT_ObjectFile && "Invalid file type!");
451 MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx); 452 MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx);
452 MCAsmBackend *MAB = TheTarget->createMCAsmBackend(TripleName, MCPU); 453 MCAsmBackend *MAB = TheTarget->createMCAsmBackend(TripleName, MCPU);
453 Str.reset(TheTarget->createMCObjectStreamer(TripleName, Ctx, *MAB, 454 Str.reset(TheTarget->createMCObjectStreamer(TripleName, Ctx, *MAB,
454 FOS, CE, RelaxAll, 455 FOS, CE, RelaxAll,
455 NoExecStack)); 456 NoExecStack));
457 // @LOCALMOD-BEGIN
458 Triple T(TripleName);
459 if (T.isOSNaCl())
460 initializeNaClMCStreamer(*Str.get(), Ctx, T);
461 // @LOCALMOD-END
456 } 462 }
457 463
458 int Res = 1; 464 int Res = 1;
459 bool disassemble = false; 465 bool disassemble = false;
460 switch (Action) { 466 switch (Action) {
461 case AC_AsLex: 467 case AC_AsLex:
462 Res = AsLexInput(SrcMgr, *MAI, Out.get()); 468 Res = AsLexInput(SrcMgr, *MAI, Out.get());
463 break; 469 break;
464 case AC_Assemble: 470 case AC_Assemble:
465 Res = AssembleInput(ProgName, TheTarget, SrcMgr, Ctx, *Str, *MAI, *STI); 471 Res = AssembleInput(ProgName, TheTarget, SrcMgr, Ctx, *Str, *MAI, *STI);
(...skipping 13 matching lines...) Expand all
479 break; 485 break;
480 } 486 }
481 if (disassemble) 487 if (disassemble)
482 Res = Disassembler::disassemble(*TheTarget, TripleName, *STI, *Str, 488 Res = Disassembler::disassemble(*TheTarget, TripleName, *STI, *Str,
483 *Buffer, SrcMgr, Out->os()); 489 *Buffer, SrcMgr, Out->os());
484 490
485 // Keep output if no errors. 491 // Keep output if no errors.
486 if (Res == 0) Out->keep(); 492 if (Res == 0) Out->keep();
487 return Res; 493 return Res;
488 } 494 }
OLDNEW
« include/llvm/Support/ELF.h ('K') | « test/MC/X86/elf-note-nacl.ll ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698