Add -no-eh-frame-hdr which negates -eh-frame-hdr.

Note that ld.bfd and ld.gold have the option.

llvm-svn: 312010
This commit is contained in:
Rui Ueyama 2017-08-29 16:53:24 +00:00
parent 4ac54d9302
commit 38eab87671
3 changed files with 15 additions and 3 deletions

View File

@ -633,7 +633,8 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
Config->DisableVerify = Args.hasArg(OPT_disable_verify);
Config->Discard = getDiscard(Args);
Config->DynamicLinker = getDynamicLinker(Args);
Config->EhFrameHdr = Args.hasArg(OPT_eh_frame_hdr);
Config->EhFrameHdr =
getArg(Args, OPT_eh_frame_hdr, OPT_no_eh_frame_hdr, false);
Config->EmitRelocs = Args.hasArg(OPT_emit_relocs);
Config->EnableNewDtags = !Args.hasArg(OPT_disable_new_dtags);
Config->Entry = Args.getLastArgValue(OPT_entry);

View File

@ -176,6 +176,9 @@ def no_demangle: F<"no-demangle">,
def no_dynamic_linker: F<"no-dynamic-linker">,
HelpText<"Inhibit output of .interp section">;
def no_eh_frame_hdr: F<"no-eh-frame-hdr">,
HelpText<"Do not create .eh_frame_hdr section">;
def no_export_dynamic: F<"no-export-dynamic">;
def no_fatal_warnings: F<"no-fatal-warnings">;

View File

@ -1,9 +1,17 @@
// REQUIRES: x86
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
// RUN: ld.lld %t.o -o %t
// RUN: llvm-readobj -file-headers -s -section-data -program-headers -symbols %t | FileCheck %s --check-prefix=NOHDR
// RUN: llvm-readobj -file-headers -s -section-data -program-headers -symbols %t \
// RUN: | FileCheck %s --check-prefix=NOHDR
// RUN: ld.lld -eh-frame-hdr -no-eh-frame-hdr %t.o -o %t
// RUN: llvm-readobj -file-headers -s -section-data -program-headers -symbols %t \
// RUN: | FileCheck %s --check-prefix=NOHDR
// RUN: ld.lld --eh-frame-hdr %t.o -o %t
// RUN: llvm-readobj -file-headers -s -section-data -program-headers -symbols %t | FileCheck %s --check-prefix=HDR
// RUN: llvm-readobj -file-headers -s -section-data -program-headers -symbols %t \
// RUN: | FileCheck %s --check-prefix=HDR
// RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=HDRDISASM
.section foo,"ax",@progbits