[lld] r251148 - Revert "[ELF2] --strip-all/-s command line implemented"
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 23 14:08:42 PDT 2015
Author: ruiu
Date: Fri Oct 23 16:08:41 2015
New Revision: 251148
URL: http://llvm.org/viewvc/llvm-project?rev=251148&view=rev
Log:
Revert "[ELF2] --strip-all/-s command line implemented"
This reverts commit r251144 because the new test is failing.
Removed:
lld/trunk/test/elf2/strip-all.s
Modified:
lld/trunk/ELF/Config.h
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/Options.td
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=251148&r1=251147&r2=251148&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Fri Oct 23 16:08:41 2015
@@ -58,7 +58,6 @@ struct Configuration {
bool NoUndefined;
bool Shared;
bool Static = false;
- bool StripAll;
bool SysvHash = true;
bool Verbose;
bool ZNodelete = false;
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=251148&r1=251147&r2=251148&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Fri Oct 23 16:08:41 2015
@@ -146,7 +146,6 @@ void LinkerDriver::createFiles(opt::Inpu
Config->NoInhibitExec = Args.hasArg(OPT_noinhibit_exec);
Config->NoUndefined = Args.hasArg(OPT_no_undefined);
Config->Shared = Args.hasArg(OPT_shared);
- Config->StripAll = Args.hasArg(OPT_strip_all);
Config->Verbose = Args.hasArg(OPT_verbose);
Config->DynamicLinker = getString(Args, OPT_dynamic_linker);
Modified: lld/trunk/ELF/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=251148&r1=251147&r2=251148&view=diff
==============================================================================
--- lld/trunk/ELF/Options.td (original)
+++ lld/trunk/ELF/Options.td Fri Oct 23 16:08:41 2015
@@ -90,9 +90,6 @@ def shared : Flag<["-"], "shared">,
def soname : Joined<["-"], "soname=">,
HelpText<"Set DT_SONAME">;
-def strip_all : Flag<["--"], "strip-all">,
- HelpText<"Strip all symbols">;
-
def sysroot : Joined<["--"], "sysroot=">,
HelpText<"Set the system root">;
@@ -127,7 +124,6 @@ def alias_shared_Bshareable : Flag<["-"]
def alias_soname_h : Separate<["-"], "h">, Alias<soname>;
def alias_soname_soname : Separate<["-"], "soname">, Alias<soname>;
def alias_script_T : Separate<["-"], "T">, Alias<script>;
-def alias_strip_all: Flag<["-"], "s">, Alias<strip_all>;
def alias_undefined_u : Separate<["-"], "u">, Alias<undefined>;
// Options listed below are silently ignored now.
@@ -139,6 +135,7 @@ def no_add_needed : Flag<["--"], "no-add
def no_fatal_warnings : Flag<["--"], "no-fatal-warnings">;
def no_warn_mismatch : Flag<["--"], "no-warn-mismatch">;
def start_group : Flag<["--"], "start-group">;
+def strip_all : Flag<["--"], "strip-all">;
def version_script : Separate<["--"], "version-script">;
def warn_common : Flag<["--"], "warn-common">;
def warn_shared_textrel : Flag<["--"], "warn-shared-textrel">;
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=251148&r1=251147&r2=251148&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Oct 23 16:08:41 2015
@@ -97,8 +97,7 @@ template <class ELFT> void lld::elf2::wr
StringTableSection<ELFT> ShStrTab(".shstrtab", false);
Out<ELFT>::ShStrTab = &ShStrTab;
StringTableSection<ELFT> StrTab(".strtab", false);
- if (!Config->StripAll)
- Out<ELFT>::StrTab = &StrTab;
+ Out<ELFT>::StrTab = &StrTab;
StringTableSection<ELFT> DynStrTab(".dynstr", true);
Out<ELFT>::DynStrTab = &DynStrTab;
OutputSection<ELFT> Bss(".bss", SHT_NOBITS, SHF_ALLOC | SHF_WRITE);
@@ -110,11 +109,8 @@ template <class ELFT> void lld::elf2::wr
Out<ELFT>::GotPlt = &GotPlt;
PltSection<ELFT> Plt;
Out<ELFT>::Plt = &Plt;
- std::unique_ptr<SymbolTableSection<ELFT>> SymTab;
- if (!Config->StripAll) {
- SymTab.reset(new SymbolTableSection<ELFT>(*Symtab, *Out<ELFT>::StrTab));
- Out<ELFT>::SymTab = SymTab.get();
- }
+ SymbolTableSection<ELFT> SymTab(*Symtab, *Out<ELFT>::StrTab);
+ Out<ELFT>::SymTab = &SymTab;
SymbolTableSection<ELFT> DynSymTab(*Symtab, *Out<ELFT>::DynStrTab);
Out<ELFT>::DynSymTab = &DynSymTab;
HashTableSection<ELFT> HashTab;
@@ -290,8 +286,7 @@ template <class ELFT> void Writer<ELFT>:
StringRef SymName = *SymNameOrErr;
if (!shouldKeepInSymtab<ELFT>(*F, SymName, Sym))
continue;
- if (Out<ELFT>::SymTab)
- Out<ELFT>::SymTab->addLocalSymbol(SymName);
+ Out<ELFT>::SymTab->addLocalSymbol(SymName);
}
}
}
@@ -517,8 +512,7 @@ template <class ELFT> void Writer<ELFT>:
CommonSymbols.push_back(C);
if (!includeInSymtab<ELFT>(*Body))
continue;
- if (Out<ELFT>::SymTab)
- Out<ELFT>::SymTab->addSymbol(Body);
+ Out<ELFT>::SymTab->addSymbol(Body);
if (isOutputDynamic() && includeInDynamicSymtab(*Body))
Out<ELFT>::DynSymTab->addSymbol(Body);
@@ -527,11 +521,9 @@ template <class ELFT> void Writer<ELFT>:
// This order is not the same as the final output order
// because we sort the sections using their attributes below.
- if (Out<ELFT>::SymTab)
- OutputSections.push_back(Out<ELFT>::SymTab);
+ OutputSections.push_back(Out<ELFT>::SymTab);
OutputSections.push_back(Out<ELFT>::ShStrTab);
- if (Out<ELFT>::StrTab)
- OutputSections.push_back(Out<ELFT>::StrTab);
+ OutputSections.push_back(Out<ELFT>::StrTab);
if (isOutputDynamic()) {
OutputSections.push_back(Out<ELFT>::DynSymTab);
if (Out<ELFT>::GnuHashTab)
Removed: lld/trunk/test/elf2/strip-all.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/strip-all.s?rev=251147&view=auto
==============================================================================
--- lld/trunk/test/elf2/strip-all.s (original)
+++ lld/trunk/test/elf2/strip-all.s (removed)
@@ -1,25 +0,0 @@
-# REQUIRES: x86
-
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: ld.lld2 %t -o %t1
-#RUN: llvm-objdump -section-headers %t1 | FileCheck %s -check-prefix BEFORE
-#BEFORE: 4 .symtab 00000030
-#BEFORE-NEXT: 5 .shstrtab 0000002c
-#BEFORE-NEXT: 6 .strtab 00000008
-
-#RUN: ld.lld2 %t.o -e main --strip-all -o %t1
-#RUN: llvm-objdump -section-headers %t1 | FileCheck %s -check-prefix AFTER
-#AFTER-NOT: .symtab
-#AFTER: 7 .shstrtab 0000003f
-#AFTER-NOT: .strtab
-
-# Test alias -s
-#RUN: ld.lld2 %t.o -e main -s -o %t1
-#RUN: llvm-objdump -section-headers %t1 | FileCheck %s -check-prefix AFTER
-
-# exits with return code 42 on linux
-.globl _start;
-_start:
- mov $60, %rax
- mov $42, %rdi
- syscall
More information about the llvm-commits
mailing list