@@ -393,121 +393,7 @@ BEGIN
393
393
$swallowArg = 1;
394
394
}
395
395
396
- # # process linker response file for hip-clang
397
- # # extract object files from static library and pass them directly to
398
- # # hip-clang in command line.
399
- # # ToDo: Remove this after hip-clang switch to lto and lld is able to
400
- # # handle clang-offload-bundler bundles.
401
- if (($arg =~ m / ^-Wl,@/ or $arg =~ m / ^@/ ) and
402
- $HIP_PLATFORM eq ' amd' ) {
403
- my @split_arg = (split /\@/, $arg ); # arg will have options type(-Wl,@ or @) and filename
404
- my $file = $split_arg [1];
405
- open my $in , " <:encoding(utf8)" , $file or die " $file : $! " ;
406
- my $new_arg = " " ;
407
- my $tmpdir = get_temp_dir ();
408
- my $new_file = " $tmpdir /response_file" ;
409
- open my $out , " >" , $new_file or die " $new_file : $! " ;
410
- while (my $line = <$in >) {
411
- chomp $line ;
412
- if ($line =~ m /\. a$ / || $line =~ m /\. lo$ / ) {
413
- my $libFile = $line ;
414
- my $path = abs_path($line );
415
- my @objs = split (' \n' , ` cd $tmpdir ; ar xv $path ` );
416
- # # Check if all files in .a are object files.
417
- my $allIsObj = 1;
418
- my $realObjs = " " ;
419
- foreach my $obj (@objs ) {
420
- chomp $obj ;
421
- $obj =~ s / ^x - // ;
422
- $obj = " $tmpdir /$obj " ;
423
- my $fileType = ` file $obj ` ;
424
- my $isObj = ($fileType =~ m / ELF/ or $fileType =~ m / COFF/ );
425
- $allIsObj = ($allIsObj and $isObj );
426
- if ($isObj ) {
427
- $realObjs = ($realObjs . " " . $obj );
428
- } else {
429
- push (@inputs , $obj );
430
- $new_arg = " $new_arg $obj " ;
431
- }
432
- }
433
- chomp $realObjs ;
434
- if ($allIsObj ) {
435
- print $out " $line \n " ;
436
- } elsif ($realObjs ) {
437
- my ($libBaseName , $libDir , $libExt ) = fileparse($libFile );
438
- $libBaseName = mktemp($libBaseName . " XXXX" ) . $libExt ;
439
- system (" cd $tmpdir ; ar rc $libBaseName $realObjs " );
440
- print $out " $tmpdir /$libBaseName \n " ;
441
- }
442
- } elsif ($line =~ m /\. o$ / ) {
443
- my $fileType = ` file $line ` ;
444
- my $isObj = ($fileType =~ m / ELF/ or $fileType =~ m / COFF/ );
445
- if ($isObj ) {
446
- print $out " $line \n " ;
447
- } else {
448
- push (@inputs , $line );
449
- $new_arg = " $new_arg $line " ;
450
- }
451
- } else {
452
- print $out " $line \n " ;
453
- }
454
- }
455
- close $in ;
456
- close $out ;
457
- $arg = " $new_arg $split_arg [0]\@ $new_file " ;
458
- $escapeArg = 0;
459
- } elsif (($arg =~ m /\. a$ / || $arg =~ m /\. lo$ / ) &&
460
- $HIP_PLATFORM eq ' amd' ) {
461
- # # process static library for hip-clang
462
- # # extract object files from static library and pass them directly to
463
- # # hip-clang.
464
- # # ToDo: Remove this after hip-clang switch to lto and lld is able to
465
- # # handle clang-offload-bundler bundles.
466
- my $new_arg = " " ;
467
- my $tmpdir = get_temp_dir ();
468
- my $libFile = $arg ;
469
- my $path = abs_path($arg );
470
- my @objs = split (' \n' , ` cd $tmpdir ; ar xv $path ` );
471
- # # Check if all files in .a are object files.
472
- my $allIsObj = 1;
473
- my $realObjs = " " ;
474
- foreach my $obj (@objs ) {
475
- chomp $obj ;
476
- $obj =~ s / ^x - // ;
477
- $obj = " $tmpdir /$obj " ;
478
- my $fileType = ` file $obj ` ;
479
- my $isObj = ($fileType =~ m / ELF/ or $fileType =~ m / COFF/ );
480
- if ($fileType =~ m / ELF/ ) {
481
- my $sections = ` $HIP_CLANG_PATH /llvm-readelf -e -W $obj ` ;
482
- $isObj = !($sections =~ m / __CLANG_OFFLOAD_BUNDLE__/ );
483
- }
484
- $allIsObj = ($allIsObj and $isObj );
485
- if ($isObj ) {
486
- $realObjs = ($realObjs . " " . $obj );
487
- } else {
488
- push (@inputs , $obj );
489
- if ($new_arg ne " " ) {
490
- $new_arg .= " " ;
491
- }
492
- $new_arg .= " $obj " ;
493
- }
494
- }
495
- chomp $realObjs ;
496
- if ($allIsObj ) {
497
- $new_arg = $arg ;
498
- } elsif ($realObjs ) {
499
- my ($libBaseName , $libDir , $libExt ) = fileparse($libFile );
500
- $libBaseName = mktemp($libBaseName . " XXXX" ) . $libExt ;
501
- system (" cd $tmpdir ; ar rc $libBaseName $realObjs " );
502
- $new_arg .= " $tmpdir /$libBaseName " ;
503
- }
504
- $arg = " $new_arg " ;
505
- $escapeArg = 0;
506
- if ($toolArgs =~ m / -Xlinker$ / ) {
507
- $toolArgs = substr $toolArgs , 0, -8;
508
- chomp $toolArgs ;
509
- }
510
- } elsif ($arg eq ' -x' ) {
396
+ if ($arg eq ' -x' ) {
511
397
$fileTypeFlag = 1;
512
398
} elsif (($arg eq ' c' and $prevArg eq ' -x' ) or ($arg eq ' -xc' )) {
513
399
$fileTypeFlag = 1;
0 commit comments