@@ -43,10 +43,12 @@ pub fn main(rustc_path: &OsStr) {
4343 let filename = format ! (
4444 "{}_audit_data.o" ,
4545 args. crate_name
46+ . as_ref( )
4647 . expect( "rustc command is missing --crate-name" )
4748 ) ;
4849 let path = args
4950 . out_dir
51+ . as_ref ( )
5052 . expect ( "rustc command is missing --out-dir" )
5153 . join ( filename) ;
5254 std:: fs:: write ( & path, file) . expect ( "Unable to write output file" ) ;
@@ -57,13 +59,21 @@ pub fn main(rustc_path: &OsStr) {
5759 command. arg ( linker_command) ;
5860 // Prevent the symbol from being removed as unused by the linker
5961 if is_apple ( & target_info) {
60- command. arg ( "-Clink-arg=-Wl,-u,_AUDITABLE_VERSION_INFO" ) ;
62+ if args. bare_linker ( ) {
63+ command. arg ( "-Clink-arg=-u,_AUDITABLE_VERSION_INFO" ) ;
64+ } else {
65+ command. arg ( "-Clink-arg=-Wl,-u,_AUDITABLE_VERSION_INFO" ) ;
66+ }
6167 } else if is_msvc ( & target_info) {
6268 command. arg ( "-Clink-arg=/INCLUDE:AUDITABLE_VERSION_INFO" ) ;
6369 } else if is_wasm ( & target_info) {
6470 // We don't emit the symbol name in WASM, so nothing to do
6571 } else {
66- command. arg ( "-Clink-arg=-Wl,--undefined=AUDITABLE_VERSION_INFO" ) ;
72+ if args. bare_linker ( ) {
73+ command. arg ( "-Clink-arg=--undefined=AUDITABLE_VERSION_INFO" ) ;
74+ } else {
75+ command. arg ( "-Clink-arg=-Wl,--undefined=AUDITABLE_VERSION_INFO" ) ;
76+ }
6777 }
6878 } else {
6979 // create_binary_file() returned None, indicating an unsupported architecture
0 commit comments