[lld] r253985 - ELF: print out a verbose error when a windows emulation is used

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 10:21:18 PST 2015


This checks for too specific type of error. I don't want to have this in
the ELF linker.

On Tue, Nov 24, 2015 at 6:52 AM, Martell Malone via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: martell
> Date: Tue Nov 24 08:52:16 2015
> New Revision: 253985
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253985&view=rev
> Log:
> ELF: print out a verbose error when a windows emulation is used
>
> Modified:
>     lld/trunk/ELF/Driver.cpp
>
> Modified: lld/trunk/ELF/Driver.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=253985&r1=253984&r2=253985&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/Driver.cpp (original)
> +++ lld/trunk/ELF/Driver.cpp Tue Nov 24 08:52:16 2015
> @@ -52,6 +52,12 @@ static std::pair<ELFKind, uint16_t> pars
>      return {ELF64LEKind, EM_X86_64};
>    if (S == "aarch64linux")
>      return {ELF64LEKind, EM_AARCH64};
> +  if (S == "i386pe")
> +    return {ELFNoneKind, EM_386};
> +  if (S == "i386pep")
> +    return {ELFNoneKind, EM_X86_64};
> +  if (S == "thumb2pe")
> +    return {ELFNoneKind, EM_ARM};
>    error("Unknown emulation: " + S);
>  }
>
> @@ -104,9 +110,21 @@ static bool hasZOption(opt::InputArgList
>  }
>
>  void LinkerDriver::main(ArrayRef<const char *> ArgsArr) {
> -  initSymbols();
>
>    opt::InputArgList Args = parseArgs(&Alloc, ArgsArr);
> +
> +  if (auto *Arg = Args.getLastArg(OPT_m)) {
> +    StringRef S = Arg->getValue();
> +    std::pair<ELFKind, uint16_t> P = parseEmulation(S);
> +    Config->EKind = P.first;
> +    Config->EMachine = P.second;
> +    Config->Emulation = S;
> +  }
> +
> +  if((Config->EKind == ELFNoneKind) && (Config->EMachine !=  EM_NONE))
> +    error("windows coff targets aren't supported on the gnu frontend.");
> +
> +  initSymbols();
>    createFiles(Args);
>
>    // Traditional linkers can generate re-linkable object files instead
> @@ -143,14 +161,6 @@ void LinkerDriver::createFiles(opt::Inpu
>    if (!RPaths.empty())
>      Config->RPath = llvm::join(RPaths.begin(), RPaths.end(), ":");
>
> -  if (auto *Arg = Args.getLastArg(OPT_m)) {
> -    StringRef S = Arg->getValue();
> -    std::pair<ELFKind, uint16_t> P = parseEmulation(S);
> -    Config->EKind = P.first;
> -    Config->EMachine = P.second;
> -    Config->Emulation = S;
> -  }
> -
>    Config->AllowMultipleDefinition =
> Args.hasArg(OPT_allow_multiple_definition);
>    Config->Bsymbolic = Args.hasArg(OPT_Bsymbolic);
>    Config->DiscardAll = Args.hasArg(OPT_discard_all);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151124/eac66aa6/attachment.html>


More information about the llvm-commits mailing list