Allow elfcopy to convert between two non-ELF formats
If the output object is not an ELF file, choose an arbitrary ELF format for the intermediate file. srec, ihex and binary formats are independent of class, endianness and machine type so these choices do not affect the output. ELF Tool Chain ticket #517 Reviewed by: kai Obtained from: ELF Tool Chain r3411
This commit is contained in:
parent
547e50e022
commit
3884d6f8bd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=295661
@ -641,6 +641,18 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst)
|
|||||||
* ELF object before processing.
|
* ELF object before processing.
|
||||||
*/
|
*/
|
||||||
if (ecp->itf != ETF_ELF) {
|
if (ecp->itf != ETF_ELF) {
|
||||||
|
/*
|
||||||
|
* If the output object is not an ELF file, choose an arbitrary
|
||||||
|
* ELF format for the intermediate file. srec, ihex and binary
|
||||||
|
* formats are independent of class, endianness and machine
|
||||||
|
* type so these choices do not affect the output.
|
||||||
|
*/
|
||||||
|
if (ecp->otf != ETF_ELF) {
|
||||||
|
if (ecp->oec == ELFCLASSNONE)
|
||||||
|
ecp->oec = ELFCLASS64;
|
||||||
|
if (ecp->oed == ELFDATANONE)
|
||||||
|
ecp->oed = ELFDATA2LSB;
|
||||||
|
}
|
||||||
create_tempfile(&elftemp, &efd);
|
create_tempfile(&elftemp, &efd);
|
||||||
if ((ecp->eout = elf_begin(efd, ELF_C_WRITE, NULL)) == NULL)
|
if ((ecp->eout = elf_begin(efd, ELF_C_WRITE, NULL)) == NULL)
|
||||||
errx(EXIT_FAILURE, "elf_begin() failed: %s",
|
errx(EXIT_FAILURE, "elf_begin() failed: %s",
|
||||||
|
Loading…
Reference in New Issue
Block a user