Index: cfe/trunk/lib/Driver/Tools.cpp =================================================================== --- cfe/trunk/lib/Driver/Tools.cpp +++ cfe/trunk/lib/Driver/Tools.cpp @@ -8197,12 +8197,12 @@ if (IsPIE) CmdArgs.push_back("-pie"); + CmdArgs.push_back("--eh-frame-hdr"); if (Args.hasArg(options::OPT_static)) { CmdArgs.push_back("-Bstatic"); } else { if (Args.hasArg(options::OPT_rdynamic)) CmdArgs.push_back("-export-dynamic"); - CmdArgs.push_back("--eh-frame-hdr"); if (Args.hasArg(options::OPT_shared)) { CmdArgs.push_back("-Bshareable"); } else { Index: cfe/trunk/test/Driver/freebsd.c =================================================================== --- cfe/trunk/test/Driver/freebsd.c +++ cfe/trunk/test/Driver/freebsd.c @@ -82,6 +82,7 @@ // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -static %s \ // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-STATIC %s +// CHECK-STATIC: ld{{.*}}" "--eh-frame-hdr" "-Bstatic" // CHECK-STATIC: crt1.o // CHECK-STATIC: crtbeginT.o