gfxboot: use a character array for an absolute symbol
authorH. Peter Anvin <hpa@zytor.com>
Sun, 14 Nov 2010 21:12:28 +0000 (13:12 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Sun, 14 Nov 2010 21:12:28 +0000 (13:12 -0800)
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@zytor.com>
com32/gfxboot/gfxboot.c

index 2323f8e..65b2d49 100644 (file)
@@ -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;