@@ -45,7 +45,7 @@ static bool debugMode = false;
45
45
46
46
static bool forceRPath = false ;
47
47
48
- static std::string fileName ;
48
+ static std::vector<std:: string> fileNames ;
49
49
static int pageSize = PAGESIZE;
50
50
51
51
typedef std::shared_ptr<std::vector<unsigned char >> FileContents;
@@ -1546,7 +1546,7 @@ static bool printNeeded = false;
1546
1546
static bool noDefaultLib = false ;
1547
1547
1548
1548
template <class ElfFile >
1549
- static void patchElf2 (ElfFile && elfFile)
1549
+ static void patchElf2 (ElfFile && elfFile, std::string fileName )
1550
1550
{
1551
1551
if (printInterpreter)
1552
1552
printf (" %s\n " , elfFile.getInterpreter ().c_str ());
@@ -1588,17 +1588,19 @@ static void patchElf2(ElfFile && elfFile)
1588
1588
1589
1589
static void patchElf ()
1590
1590
{
1591
- if (!printInterpreter && !printRPath && !printSoname && !printNeeded)
1592
- debug (" patching ELF file '%s'\n " , fileName.c_str ());
1591
+ for (auto fileName : fileNames) {
1592
+ if (!printInterpreter && !printRPath && !printSoname && !printNeeded)
1593
+ debug (" patching ELF file '%s'\n " , fileName.c_str ());
1593
1594
1594
- debug (" Kernel page size is %u bytes\n " , getPageSize ());
1595
+ debug (" Kernel page size is %u bytes\n " , getPageSize ());
1595
1596
1596
- auto fileContents = readFile (fileName);
1597
+ auto fileContents = readFile (fileName);
1597
1598
1598
- if (getElfType (fileContents).is32Bit )
1599
- patchElf2 (ElfFile<Elf32_Ehdr, Elf32_Phdr, Elf32_Shdr, Elf32_Addr, Elf32_Off, Elf32_Dyn, Elf32_Sym, Elf32_Verneed>(fileContents));
1600
- else
1601
- patchElf2 (ElfFile<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, Elf64_Addr, Elf64_Off, Elf64_Dyn, Elf64_Sym, Elf64_Verneed>(fileContents));
1599
+ if (getElfType (fileContents).is32Bit )
1600
+ patchElf2 (ElfFile<Elf32_Ehdr, Elf32_Phdr, Elf32_Shdr, Elf32_Addr, Elf32_Off, Elf32_Dyn, Elf32_Sym, Elf32_Verneed>(fileContents), fileName);
1601
+ else
1602
+ patchElf2 (ElfFile<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, Elf64_Addr, Elf64_Off, Elf64_Dyn, Elf64_Sym, Elf64_Verneed>(fileContents), fileName);
1603
+ }
1602
1604
}
1603
1605
1604
1606
@@ -1721,11 +1723,12 @@ int mainWrapped(int argc, char * * argv)
1721
1723
printf (PACKAGE_STRING " \n " );
1722
1724
return 0 ;
1723
1725
}
1724
- else break ;
1726
+ else {
1727
+ fileNames.push_back (arg);
1728
+ }
1725
1729
}
1726
1730
1727
- if (i == argc) error (" missing filename" );
1728
- fileName = argv[i];
1731
+ if (fileNames.empty ()) error (" missing filename" );
1729
1732
1730
1733
patchElf ();
1731
1734
0 commit comments