forked from OSchip/llvm-project
[lld-macho] Implement -S
There are a couple internal builds that require the use of this flag. Reviewed By: #lld-macho, int3 Differential Revision: https://reviews.llvm.org/D112594
This commit is contained in:
parent
6c7b203d1d
commit
d54360cd32
|
@ -121,6 +121,7 @@ struct Configuration {
|
|||
bool timeTraceEnabled = false;
|
||||
bool dataConst = false;
|
||||
bool dedupLiterals = true;
|
||||
bool omitDebugInfo = false;
|
||||
uint32_t headerPad;
|
||||
uint32_t dylibCompatibilityVersion = 0;
|
||||
uint32_t dylibCurrentVersion = 0;
|
||||
|
|
|
@ -1170,6 +1170,7 @@ bool macho::link(ArrayRef<const char *> argsArr, bool canExitEarly,
|
|||
args.hasArg(OPT_print_dylib_search) || getenv("RC_TRACE_DYLIB_SEARCHING");
|
||||
config->printEachFile = args.hasArg(OPT_t);
|
||||
config->printWhyLoad = args.hasArg(OPT_why_load);
|
||||
config->omitDebugInfo = args.hasArg(OPT_S);
|
||||
config->outputType = getOutputType(args);
|
||||
if (const Arg *arg = args.getLastArg(OPT_bundle_loader)) {
|
||||
if (config->outputType != MH_BUNDLE)
|
||||
|
|
|
@ -557,7 +557,6 @@ def grp_symtab : OptionGroup<"symtab">, HelpText<"SYMBOL TABLE">;
|
|||
|
||||
def S : Flag<["-"], "S">,
|
||||
HelpText<"Strip debug information (STABS or DWARF) from the output">,
|
||||
Flags<[HelpHidden]>,
|
||||
Group<grp_symtab>;
|
||||
def x : Flag<["-"], "x">,
|
||||
HelpText<"Exclude non-global symbols from the output symbol table">,
|
||||
|
|
|
@ -876,6 +876,9 @@ void SymtabSection::emitEndFunStab(Defined *defined) {
|
|||
}
|
||||
|
||||
void SymtabSection::emitStabs() {
|
||||
if (config->omitDebugInfo)
|
||||
return;
|
||||
|
||||
for (const std::string &s : config->astPaths) {
|
||||
StabsEntry astStab(N_AST);
|
||||
astStab.strx = stringTableSection.addString(s);
|
||||
|
|
|
@ -53,13 +53,18 @@
|
|||
## Check that we emit relative path to object files in OSO entries
|
||||
## when -oso_prefix <path> is used.
|
||||
# RUN: cd %t && %lld -lSystem test.o foo.o no-debug.o -oso_prefix "%t" -o %t/test-rel
|
||||
# RUN: dsymutil -s %t/test-rel | grep 'N_OSO' | FileCheck %s -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-PATH
|
||||
# RUN: dsymutil -s %t/test-rel | grep 'N_OSO' | FileCheck %s -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-PATH
|
||||
# RUN: cd %t && %lld -lSystem test.o foo.o no-debug.o -oso_prefix "." -o %t/test-rel-dot
|
||||
# RUN: dsymutil -s %t/test-rel-dot | grep 'N_OSO' | FileCheck %s -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT
|
||||
# RUN: dsymutil -s %t/test-rel-dot | grep 'N_OSO' | FileCheck %s -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT
|
||||
## Set HOME to %t (for ~ to expand to)
|
||||
# RUN: cd %t && env HOME=%t %lld -lSystem test.o foo.o no-debug.o -oso_prefix "~" -o %t/test-rel-tilde
|
||||
# RUN: dsymutil -s %t/test-rel-tilde | grep 'N_OSO' | FileCheck %s -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-PATH
|
||||
|
||||
## Check that we don't emit DWARF or stabs when -S is used
|
||||
# RUN: %lld -lSystem test.o foo.o no-debug.o -S -o %t/test-no-debug
|
||||
## grep returns an exit code of 1 if it cannot match the intended pattern. We
|
||||
## expect to not find any entries which requires the exit code to be negated.
|
||||
# RUN: llvm-nm -ap %t/test-no-debug | not grep -e ' - '
|
||||
|
||||
# RUN: cd %t && %lld -lSystem test.o foo.a no-debug.o -o %t/test
|
||||
# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
|
||||
|
@ -77,7 +82,7 @@
|
|||
# CHECK: (N_SO ) 00 0000 0000000000000000 '/tmp/test.cpp'
|
||||
# CHECK-NEXT: (N_OSO ) 03 0001 [[#%.16x,TEST_TIME]] '[[DIR]]/test.o'
|
||||
# REL-PATH: (N_OSO ) 03 0001 [[#%.16x,TEST_TIME]] '/test.o'
|
||||
# REL-DOT: (N_OSO ) 03 0001 [[#%.16x,TEST_TIME]] 'test.o'
|
||||
# REL-DOT: (N_OSO ) 03 0001 [[#%.16x,TEST_TIME]] 'test.o'
|
||||
# CHECK-NEXT: (N_STSYM ) [[#%.2d,MORE_DATA_ID + 1]] 0000 [[#%.16x,STATIC:]] '_static_var'
|
||||
# CHECK-NEXT: (N_FUN ) [[#%.2d,TEXT_ID + 1]] 0000 [[#%.16x,MAIN:]] '_main'
|
||||
# CHECK-NEXT: (N_FUN ) 00 0000 0000000000000006{{$}}
|
||||
|
|
Loading…
Reference in New Issue