Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -766,6 +766,14 @@ // Initializes Config members by the command line options. void LinkerDriver::readConfigs(opt::InputArgList &Args) { +#if defined(__NetBSD__) +// NetBSD prefers RPATH, and does not allow RUNPATH until very recently +# define DEFAULT_NEW_DTAGS false +#else +# define DEFAULT_NEW_DTAGS true +#endif + + errorHandler().Verbose = Args.hasArg(OPT_verbose); errorHandler().FatalWarnings = Args.hasFlag(OPT_fatal_warnings, OPT_no_fatal_warnings, false); @@ -797,7 +805,8 @@ Config->CallGraphProfileSort = Args.hasFlag( OPT_call_graph_profile_sort, OPT_no_call_graph_profile_sort, true); Config->EnableNewDtags = - Args.hasFlag(OPT_enable_new_dtags, OPT_disable_new_dtags, true); + Args.hasFlag(OPT_enable_new_dtags, OPT_disable_new_dtags, + DEFAULT_NEW_DTAGS); Config->Entry = Args.getLastArgValue(OPT_entry); Config->ExecuteOnly = Args.hasFlag(OPT_execute_only, OPT_no_execute_only, false);