mirror of https://github.com/ipxe/ipxe.git
[efi] Use POSIX version of basename() in elf2efi.c
This is required in order to build on Mac OS X. Suggested-by: Joshua Oreman <oremanj@rwcr.net>pull/1/head
parent
e3b9e3d04b
commit
bbd274a1d6
|
@ -29,6 +29,7 @@
|
||||||
#include <bfd.h>
|
#include <bfd.h>
|
||||||
#include <gpxe/efi/efi.h>
|
#include <gpxe/efi/efi.h>
|
||||||
#include <gpxe/efi/IndustryStandard/PeImage.h>
|
#include <gpxe/efi/IndustryStandard/PeImage.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
|
||||||
#define eprintf(...) fprintf ( stderr, __VA_ARGS__ )
|
#define eprintf(...) fprintf ( stderr, __VA_ARGS__ )
|
||||||
|
|
||||||
|
@ -658,6 +659,7 @@ static void write_pe_file ( struct pe_header *pe_header,
|
||||||
*/
|
*/
|
||||||
static void elf2pe ( const char *elf_name, const char *pe_name,
|
static void elf2pe ( const char *elf_name, const char *pe_name,
|
||||||
struct options *opts ) {
|
struct options *opts ) {
|
||||||
|
char pe_name_tmp[ strlen ( pe_name ) + 1 ];
|
||||||
bfd *bfd;
|
bfd *bfd;
|
||||||
asymbol **symtab;
|
asymbol **symtab;
|
||||||
asection *section;
|
asection *section;
|
||||||
|
@ -669,6 +671,9 @@ static void elf2pe ( const char *elf_name, const char *pe_name,
|
||||||
struct pe_header pe_header;
|
struct pe_header pe_header;
|
||||||
FILE *pe;
|
FILE *pe;
|
||||||
|
|
||||||
|
/* Create a modifiable copy of the PE name */
|
||||||
|
memcpy ( pe_name_tmp, pe_name, sizeof ( pe_name_tmp ) );
|
||||||
|
|
||||||
/* Open the file */
|
/* Open the file */
|
||||||
bfd = open_input_bfd ( elf_name );
|
bfd = open_input_bfd ( elf_name );
|
||||||
symtab = read_symtab ( bfd );
|
symtab = read_symtab ( bfd );
|
||||||
|
@ -703,7 +708,7 @@ static void elf2pe ( const char *elf_name, const char *pe_name,
|
||||||
|
|
||||||
/* Create the .reloc section */
|
/* Create the .reloc section */
|
||||||
*(next_pe_section) = create_debug_section ( &pe_header,
|
*(next_pe_section) = create_debug_section ( &pe_header,
|
||||||
basename ( pe_name ) );
|
basename ( pe_name_tmp ) );
|
||||||
next_pe_section = &(*next_pe_section)->next;
|
next_pe_section = &(*next_pe_section)->next;
|
||||||
|
|
||||||
/* Write out PE file */
|
/* Write out PE file */
|
||||||
|
|
Loading…
Reference in New Issue