aboutsummaryrefslogtreecommitdiffstats
path: root/gpxe/src/util/elf2efi.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-02-03 16:06:41 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-02-03 16:06:41 -0800
commitaddaeaeb3949d576c4e0eb5cfc133b7c3bcfa8fa (patch)
tree2ffea726dc494e87ecc9f506bc6a2bc9242730e3 /gpxe/src/util/elf2efi.c
parent5c0f48e49f8d7d084810ecf0b98a76aaebb44835 (diff)
parente7a5f95432132c8fc8f8ede39fda1d368002ddd8 (diff)
downloadsyslinux.git-addaeaeb3949d576c4e0eb5cfc133b7c3bcfa8fa.tar.gz
syslinux.git-addaeaeb3949d576c4e0eb5cfc133b7c3bcfa8fa.tar.xz
syslinux.git-addaeaeb3949d576c4e0eb5cfc133b7c3bcfa8fa.zip
Merge branch 'master' into i915res
Diffstat (limited to 'gpxe/src/util/elf2efi.c')
-rw-r--r--gpxe/src/util/elf2efi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gpxe/src/util/elf2efi.c b/gpxe/src/util/elf2efi.c
index 886777d9..bb766bd3 100644
--- a/gpxe/src/util/elf2efi.c
+++ b/gpxe/src/util/elf2efi.c
@@ -29,6 +29,7 @@
#include <bfd.h>
#include <gpxe/efi/efi.h>
#include <gpxe/efi/IndustryStandard/PeImage.h>
+#include <libgen.h>
#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,
struct options *opts ) {
+ char pe_name_tmp[ strlen ( pe_name ) + 1 ];
bfd *bfd;
asymbol **symtab;
asection *section;
@@ -669,6 +671,9 @@ static void elf2pe ( const char *elf_name, const char *pe_name,
struct pe_header pe_header;
FILE *pe;
+ /* Create a modifiable copy of the PE name */
+ memcpy ( pe_name_tmp, pe_name, sizeof ( pe_name_tmp ) );
+
/* Open the file */
bfd = open_input_bfd ( elf_name );
symtab = read_symtab ( bfd );
@@ -703,7 +708,7 @@ static void elf2pe ( const char *elf_name, const char *pe_name,
/* Create the .reloc section */
*(next_pe_section) = create_debug_section ( &pe_header,
- basename ( pe_name ) );
+ basename ( pe_name_tmp ) );
next_pe_section = &(*next_pe_section)->next;
/* Write out PE file */