[syslinux:master] gfxboot: use a character array for an absolute symbol

syslinux-bot for H. Peter Anvin hpa at zytor.com
Sun Nov 14 13:15:19 PST 2010


Commit-ID:  51d2e40990ce9d2360300a81562b1b2f7610d336
Gitweb:     http://syslinux.zytor.com/commit/51d2e40990ce9d2360300a81562b1b2f7610d336
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Sun, 14 Nov 2010 13:12:28 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Sun, 14 Nov 2010 13:12:28 -0800

gfxboot: use a character array for an absolute symbol

The best way to access an absolute symbol is "extern const char
foo[];" -- older gccs let you get away with "extern void" but gcc 4.5
chokes on it.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 com32/gfxboot/gfxboot.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/com32/gfxboot/gfxboot.c b/com32/gfxboot/gfxboot.c
index 2323f8e..65b2d49 100644
--- a/com32/gfxboot/gfxboot.c
+++ b/com32/gfxboot/gfxboot.c
@@ -61,7 +61,7 @@
 #define GFX_CB_PASSWORD_DONE	11
 
 // real mode code chunk, will be placed into bounce buffer
-extern void realmode_callback_start, realmode_callback_end;
+extern const char realmode_callback_start[], realmode_callback_end[];
 
 // gets in the way
 #undef linux
@@ -557,7 +557,7 @@ int gfx_init(char *file)
 
   gfx_config.file = gfx_config.archive_start + file_start;
 
-  u = &realmode_callback_end - &realmode_callback_start;
+  u = realmode_callback_end - realmode_callback_start;
   u = (u + REALMODE_BUF_SIZE + 0xf) & ~0xf;
 
   if(u + code_size > lowmem_size) {
@@ -565,7 +565,8 @@ int gfx_init(char *file)
     return 1;
   }
 
-  memcpy(lowmem + REALMODE_BUF_SIZE, &realmode_callback_start, &realmode_callback_end - &realmode_callback_start);
+  memcpy(lowmem + REALMODE_BUF_SIZE, realmode_callback_start,
+	 realmode_callback_end - realmode_callback_start);
 
   // fill in buffer size and location
   *(uint16_t *) (lowmem + REALMODE_BUF_SIZE) = REALMODE_BUF_SIZE;



More information about the Syslinux-commits mailing list