mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
Recognize --strip-all as a synonym for -s.
Add -S and --strip-debug option support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18441 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -130,13 +130,14 @@ static inline void addPass(PassManager &PM, Pass *P) {
|
|||||||
///
|
///
|
||||||
/// Inputs:
|
/// Inputs:
|
||||||
/// M - The module for which bytecode should be generated.
|
/// M - The module for which bytecode should be generated.
|
||||||
/// Strip - Flags whether symbols should be stripped from the output.
|
/// StripLevel - 2 if we should strip all symbols, 1 if we should strip
|
||||||
|
/// debug info.
|
||||||
/// Internalize - Flags whether all symbols should be marked internal.
|
/// Internalize - Flags whether all symbols should be marked internal.
|
||||||
/// Out - Pointer to file stream to which to write the output.
|
/// Out - Pointer to file stream to which to write the output.
|
||||||
///
|
///
|
||||||
/// Returns non-zero value on error.
|
/// Returns non-zero value on error.
|
||||||
///
|
///
|
||||||
int llvm::GenerateBytecode(Module *M, bool Strip, bool Internalize,
|
int llvm::GenerateBytecode(Module *M, int StripLevel, bool Internalize,
|
||||||
std::ostream *Out) {
|
std::ostream *Out) {
|
||||||
// In addition to just linking the input from GCC, we also want to spiff it up
|
// In addition to just linking the input from GCC, we also want to spiff it up
|
||||||
// a little bit. Do this now.
|
// a little bit. Do this now.
|
||||||
@ -208,11 +209,11 @@ int llvm::GenerateBytecode(Module *M, bool Strip, bool Internalize,
|
|||||||
addPass(Passes, createGlobalDCEPass());
|
addPass(Passes, createGlobalDCEPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the -s command line option was specified, strip the symbols out of the
|
// If the -s or -S command line options were specified, strip the symbols out
|
||||||
// resulting program to make it smaller. -s is a GCC option that we are
|
// of the resulting program to make it smaller. -s and -S are GLD options
|
||||||
// supporting.
|
// that we are supporting.
|
||||||
if (Strip)
|
if (StripLevel)
|
||||||
addPass(Passes, createSymbolStrippingPass());
|
addPass(Passes, createStripSymbolsPass(StripLevel == 1));
|
||||||
|
|
||||||
// Make sure everything is still good.
|
// Make sure everything is still good.
|
||||||
Passes.add(createVerifierPass());
|
Passes.add(createVerifierPass());
|
||||||
|
@ -58,7 +58,10 @@ namespace {
|
|||||||
cl::value_desc("library prefix"));
|
cl::value_desc("library prefix"));
|
||||||
|
|
||||||
cl::opt<bool>
|
cl::opt<bool>
|
||||||
Strip("s", cl::desc("Strip symbol info from executable"));
|
Strip("strip-all", cl::desc("Strip all symbol info from executable"));
|
||||||
|
cl::opt<bool>
|
||||||
|
StripDebug("strip-debug",
|
||||||
|
cl::desc("Strip debugger symbol info from executable"));
|
||||||
|
|
||||||
cl::opt<bool>
|
cl::opt<bool>
|
||||||
NoInternalize("disable-internalize",
|
NoInternalize("disable-internalize",
|
||||||
@ -90,6 +93,11 @@ namespace {
|
|||||||
CO5("eh-frame-hdr", cl::Hidden, cl::desc("Compatibility option: ignored"));
|
CO5("eh-frame-hdr", cl::Hidden, cl::desc("Compatibility option: ignored"));
|
||||||
cl::opt<std::string>
|
cl::opt<std::string>
|
||||||
CO6("h", cl::Hidden, cl::desc("Compatibility option: ignored"));
|
CO6("h", cl::Hidden, cl::desc("Compatibility option: ignored"));
|
||||||
|
|
||||||
|
cl::alias A0("s", cl::desc("Alias for --strip-all"),
|
||||||
|
cl::aliasopt(Strip));
|
||||||
|
cl::alias A1("S", cl::desc("Alias for --strip-debug"),
|
||||||
|
cl::aliasopt(StripDebug));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// PrintAndReturn - Prints a message to standard error and returns true.
|
/// PrintAndReturn - Prints a message to standard error and returns true.
|
||||||
@ -199,7 +207,8 @@ int main(int argc, char **argv, char **envp) {
|
|||||||
sys::RemoveFileOnSignal(sys::Path(RealBytecodeOutput));
|
sys::RemoveFileOnSignal(sys::Path(RealBytecodeOutput));
|
||||||
|
|
||||||
// Generate the bytecode file.
|
// Generate the bytecode file.
|
||||||
if (GenerateBytecode(Composite.get(), Strip, !NoInternalize, &Out)) {
|
int StripLevel = Strip ? 2 : (StripDebug ? 1 : 0);
|
||||||
|
if (GenerateBytecode(Composite.get(), StripLevel, !NoInternalize, &Out)) {
|
||||||
Out.close();
|
Out.close();
|
||||||
return PrintAndReturn(argv[0], "error generating bytecode");
|
return PrintAndReturn(argv[0], "error generating bytecode");
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace llvm {
|
|||||||
|
|
||||||
int
|
int
|
||||||
GenerateBytecode (Module * M,
|
GenerateBytecode (Module * M,
|
||||||
bool Strip,
|
int StripLevel,
|
||||||
bool Internalize,
|
bool Internalize,
|
||||||
std::ostream * Out);
|
std::ostream * Out);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user