File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -664,11 +664,13 @@ fn link_natively(sess: &Session,
664664 let out = String :: from_utf8_lossy ( & out) ;
665665
666666 // Check to see if the link failed with "unrecognized command line option:
667- // '-no-pie'". If so, reperform the link step without the -no-pie option. This
668- // is safe because if the linker doesn't support -no-pie then it should not
669- // default to linking executables as pie. Different versions of gcc seem to
670- // use different quotes in the error message so don't check for them.
671- if out. contains ( "unrecognized command line option" ) &&
667+ // '-no-pie'" for gcc or "unknown argument: '-no-pie'" for clang. If so,
668+ // reperform the link step without the -no-pie option. This is safe because
669+ // if the linker doesn't support -no-pie then it should not default to
670+ // linking executables as pie. Different versions of gcc seem to use
671+ // different quotes in the error message so don't check for them.
672+ if ( out. contains ( "unrecognized command line option" ) ||
673+ out. contains ( "unknown argument" ) ) &&
672674 out. contains ( "-no-pie" ) &&
673675 cmd. get_args ( ) . iter ( ) . any ( |e| e. to_string_lossy ( ) == "-no-pie" ) {
674676 info ! ( "linker output: {:?}" , out) ;
You can’t perform that action at this time.
0 commit comments