Author: jhb
Date: Wed Jan  3 17:40:51 2018
New Revision: 327524
URL: https://svnweb.freebsd.org/changeset/base/327524

Log:
  Use 'extern uint8_t' instead of 'extern void' for external symbols.
  
  The beri boot loaders depend on symbols defined in linker scripts or
  assembly files.  The boot loaders do not care about the type of these
  symbols but just want to extract a pointer to them.  Older versions of
  GCC permitted external symbols to be declared of type 'void' and then
  '&foo' generated a void pointer to the memory at the symbol's address.
  However, void objects are not valid C and newer versions of GCC error if
  these are used.  Instead, declare these symbols as being bytes (or
  an array of bytes in the cheri_sdcard_vaddr case).
  
  Sponsored by: DARPA / AFRL

Modified:
  head/stand/mips/beri/common/sdcard.c
  head/stand/mips/beri/loader/main.c

Modified: head/stand/mips/beri/common/sdcard.c
==============================================================================
--- head/stand/mips/beri/common/sdcard.c        Wed Jan  3 17:35:38 2018        
(r327523)
+++ head/stand/mips/beri/common/sdcard.c        Wed Jan  3 17:40:51 2018        
(r327524)
@@ -109,10 +109,10 @@
     ALTERA_SDCARD_RR1_COMMANDCRCFAILED | ALTERA_SDCARD_RR1_ADDRESSMISALIGNED |\
     ALTERA_SDCARD_RR1_ADDRBLOCKRANGE)
 
-extern void __cheri_sdcard_vaddr__;
+extern uint8_t __cheri_sdcard_vaddr__[];
 
 #define        ALTERA_SDCARD_PTR(type, offset)                                 
\
-       (volatile type *)((uint8_t *)&__cheri_sdcard_vaddr__ + (offset))
+       (volatile type *)(&__cheri_sdcard_vaddr__[(offset)])
 
 static __inline uint16_t
 altera_sdcard_read_uint16(u_int offset)

Modified: head/stand/mips/beri/loader/main.c
==============================================================================
--- head/stand/mips/beri/loader/main.c  Wed Jan  3 17:35:38 2018        
(r327523)
+++ head/stand/mips/beri/loader/main.c  Wed Jan  3 17:40:51 2018        
(r327524)
@@ -78,8 +78,8 @@ struct console *consoles[] = {
        NULL
 };
 
-extern void    __bss_start, __bss_end;
-extern void    __heap_start, __heap_end;
+extern uint8_t __bss_start, __bss_end;
+extern uint8_t __heap_start, __heap_end;
 
 static int
 __elfN(exec)(struct preloaded_file *fp)
@@ -108,14 +108,14 @@ main(int argc, char *argv[], char *envv[], struct boot
        struct devsw **dp;
 
        /* NB: Must be sure to bzero() before using any globals. */
-       bzero(&__bss_start, (uintptr_t)&__bss_end - (uintptr_t)&__bss_start);
+       bzero(&__bss_start, &__bss_end - &__bss_start);
 
        boot2_argc = argc;
        boot2_argv = argv;
        boot2_envv = envv;
        boot2_bootinfo = *bootinfop;    /* Copy rather than by reference. */
 
-       setheap((void *)&__heap_start, (void *)&__heap_end);
+       setheap(&__heap_start, &__heap_end);
 
        /*
         * Pick up console settings from boot2; probe console.
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to