grub4dos
grub4dos copied to clipboard
Compiling source code gives lots of messages on unguarded ifs and while??
Have a user that booted my project that uses grub4dos UEFI. It displays the background image but doesn't then display any of them menu options and keyboard seems to be totally dead.
Download the source code, since I was just using binary. Did the configure and make and it comes up with lots of messages about unguarded if's and while's. First few seemed obvious with just space and tab differences, but the third one isn't. line 4453 of builtins.c looks like if followed with next line with ; at end, but then next lines stay at the indented position.
Seen some issues with various versions of compiler to build programs. Make ends with
collect2: error: ld returned 1 exit status make[2]: *** [Makefile:612: pre_stage2.exec] Error 1 make[2]: Leaving directory '/home/msetzerii/Downloads/grub4dos-for_UEFI/stage2' make[1]: *** [Makefile:373: all-recursive] Error 1 make[1]: Leaving directory '/home/msetzerii/Downloads/grub4dos-for_UEFI' make: *** [Makefile:313: all] Error 2
ubuntu18.04 gcc4.8
gcc4.8 seems very very old.
gcc --version
gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)
$ uname -a
Linux setzconote.dyndns.org 5.16.20-100.fc34.x86_64 #1 SMP PREEMPT Wed Apr 13 22:10:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Errors reported.
builtins.c: In function ‘chainloader_func’:
builtins.c:1239:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
1239 | if (errnum == ERR_NONE)
| ^~
builtins.c:1242:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
1242 | if (address)
| ^~
builtins.c: In function ‘configfile_func’:
builtins.c:1799:9: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
1799 | while ((*new_config++ = *arg++));
| ^~~~~
builtins.c:1800:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
1800 | grub_close ();
| ^~~~~~~~~~
builtins.c: In function ‘font_func’:
builtins.c:4400:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
4400 | if (filemax >> 32) // file too long
| ^~
builtins.c:4403:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
4403 | num_wide = (font_h+7)/8;
| ^~~~~~~~
builtins.c:4453:17: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
4453 | if (unifont_simp_on)
| ^~
builtins.c:4455:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
4455 | *(unsigned char *)(narrow_mem + unicode/8) &= ~(1 << (unicode&7));
| ^
builtins.c: In function ‘skip_data_ref_object’:
builtins.c:5505:7: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
5505 | for (ptr++; ptr < end && *ptr; ptr++);
| ^~~
builtins.c:5506:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
5506 | if (ptr == end)
| ^~
builtins.c: In function ‘map_func’:
builtins.c:8143:67: warning: taking address of packed member of ‘struct fragment_map_slot’ may result in an unaligned pointer value [-Waddress-of-packed-member]
8143 | struct fragment *to_ = (struct fragment *)&q->fragment_data;
| ^~~~~~~~~~~~~~~~~
builtins.c:8216:57: warning: taking address of packed member of ‘struct fragment_map_slot’ may result in an unaligned pointer value [-Waddress-of-packed-member]
8216 | struct fragment *f = (struct fragment *)&q->fragment_data;
| ^~~~~~~~~~~~~~~~~
builtins.c: In function ‘pause_func’:
builtins.c:9134:3: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
9134 | while ((time2 = getrtsecs ()) == 0xFF);
| ^~~~~
builtins.c:9135:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
9135 | while (wait != 0)
| ^~~~~
builtins.c: In function ‘setkey_func’:
builtins.c:10603:7: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
10603 | else
| ^~~~
builtins.c:10605:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
10605 | ascii_key_map[i].to_code = to_code;
| ^~~~~~~~~~~~~
builtins.c: In function ‘s_calc’:
builtins.c:11041:5: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
11041 | else
| ^~~~
builtins.c:11044:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
11044 | val1 = *p_result;
| ^~~~
builtins.c: In function ‘map_func’:
builtins.c:7696:16: warning: array subscript 160 is outside array bounds of ‘struct fragment_map_slot[1]’ [-Warray-bounds]
7696 | filename = (char *)q + FRAGMENT_MAP_SLOT_SIZE; //碎片插槽结束
In file included from builtins.c:21:
./shared.h:5680:33: note: while referencing ‘disk_fragment_map’
5680 | extern struct fragment_map_slot disk_fragment_map;
| ^~~~~~~~~~~~~~~~~
builtins.c:7696:16: warning: array subscript 160 is outside array bounds of ‘struct fragment_map_slot[1]’ [-Warray-bounds]
7696 | filename = (char *)q + FRAGMENT_MAP_SLOT_SIZE; //碎片插槽结束
In file included from builtins.c:21:
./shared.h:5680:33: note: while referencing ‘disk_fragment_map’
5680 | extern struct fragment_map_slot disk_fragment_map;
| ^~~~~~~~~~~~~~~~~
char_io.c: In function ‘grub_sprintf’:
char_io.c:437:11: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
437 | else
| ^~~~
char_io.c:439:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
439 | break;
| ^~~~~
char_io.c: At top level:
char_io.c:2172:7: warning: ‘memcpy’ alias between functions of incompatible types ‘void *(void *, const void *, int)’ and ‘void *(void *, const void *, grub_size_t)’ {aka ‘void *(void *, const void *, long long unsigned int)’} [-Wattribute-alias=]
2172 | void *memcpy (void *dest, const void *src, int n) attribute ((alias ("grub_memmove")));
| ^~~~~~
char_io.c:2077:1: note: aliased declaration here
2077 | grub_memmove (void *to, const void *from, grub_size_t len)
| ^~~~~~~~~~~~
cmdline.c: In function ‘enter_cmdline’:
cmdline.c:585:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
585 | if (use_pager)
| ^~
cmdline.c:588:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
588 | errnum = errnum_old;
| ^~~~~~
console.c: In function ‘console_setcolor’:
console.c:148:17: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
148 | if (!(state & (1<<i)))
| ^~
console.c:150:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
150 | console_color[i] = color_64_to_8(color[i]);
| ^~~~~~~~~~~~~
dec_vhd.c: In function ‘vhd_footer_in’:
dec_vhd.c:132:18: warning: taking address of packed member of ‘struct VHDFooter’ may result in an unaligned pointer value [-Waddress-of-packed-member]
132 | bswap_64(&footer->dataOffset); //数据偏移 200
| ^~~~~~~~~~~~~~~~~~~
dec_vhd.c:133:18: warning: taking address of packed member of ‘struct VHDFooter’ may result in an unaligned pointer value [-Waddress-of-packed-member]
133 | bswap_64(&footer->currentSize); //当前尺寸 4004000
| ^~~~~~~~~~~~~~~~~~~~
dec_vhd.c:134:18: warning: taking address of packed member of ‘struct VHDFooter’ may result in an unaligned pointer value [-Waddress-of-packed-member]
134 | bswap_32(&footer->diskType); //磁盘类型 3
| ^~~~~~~~~~~~~~~~~
dec_vhd.c: In function ‘vhd_header_in’:
dec_vhd.c:140:18: warning: taking address of packed member of ‘struct VHDDynamicDiskHeader’ may result in an unaligned pointer value [-Waddress-of-packed-member]
140 | bswap_64(&header->tableOffset); //BAT结构偏移 600
| ^~~~~~~~~~~~~~~~~~~~
dec_vhd.c:141:18: warning: taking address of packed member of ‘struct VHDDynamicDiskHeader’ may result in an unaligned pointer value [-Waddress-of-packed-member]
141 | bswap_32(&header->maxTableEntries); //BAT条目的最大值 21
| ^~~~~~~~~~~~~~~~~~~~~~~~
dec_vhd.c:142:18: warning: taking address of packed member of ‘struct VHDDynamicDiskHeader’ may result in an unaligned pointer value [-Waddress-of-packed-member]
142 | bswap_32(&header->blockSize); //块尺寸 200000
| ^~~~~~~~~~~~~~~~~~
dec_vhd.c: In function ‘dec_vhd_open’:
dec_vhd.c:206:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
206 | if (footer->diskType != VHD_DISKTYPE_DYNAMIC && footer->diskType != VHD_DISKTYPE_DIFFERENCE) //磁盘类型不是动态, 不是差分, 退出
| ^~
dec_vhd.c:209:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
209 | if (footer->dataOffset + sizeof(VHDDynamicDiskHeader) > filemax) { //数据偏移+VHD页脚表 > filemax, 退出
| ^~
dec_vhd.c: In function ‘dec_vhd_read’:
dec_vhd.c:360:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
360 | if (filepos + len > vhdfc->volumeSize)
| ^~
dec_vhd.c:363:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
363 | if (write == GRUB_WRITE) {
| ^~
disk_io.c: In function ‘next_pc_slice’:
disk_io.c:731:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
731 | if (! rawread (next_partition_drive, *next_partition_offset, 0, SECTOR_SIZE, (unsigned long long)(grub_size_t)next_partition_buf, 0xedde0d90))
| ^~
disk_io.c:734:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
734 | if (pc_slice_no == (unsigned int)-1 && next_partition_buf[0x1C2] == '\xEE' && is_gpt_part())
| ^~
disk_io.c:813:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
813 | if (next_partition_dest != 0xffffff)
| ^~
disk_io.c:816:11: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
816 | return 0;
| ^~~~~~
disk_io.c: In function ‘grub_efidisk_readwrite’:
disk_io.c:2991:31: warning: taking address of packed member of ‘struct fragment_map_slot’ may result in an unaligned pointer value [-Waddress-of-packed-member]
2991 | data = (struct fragment )&q->fragment_data;
| ^~~~~~~~~~~~~~~~~
disk_io.c: In function ‘devread’:
disk_io.c:377:13: warning: array subscript -1 is outside array bounds of ‘unsigned int[1]’ [-Warray-bounds]
377 | rw_flag = (unsigned int)(&write - 1);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
disk_io.c:371:135: note: while referencing ‘write’
371 | devread (unsigned long long sector, unsigned long long byte_offset, unsigned long long byte_len, unsigned long long buf, unsigned int write)
| ~~~~~~~~~~~~~^~~~~
disk_io.c:380:9: warning: array subscript -1 is outside array bounds of ‘unsigned int[1]’ [-Warray-bounds]
380 | buf = (unsigned long long)(&write - 3);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
disk_io.c:371:135: note: while referencing ‘write’
371 | devread (unsigned long long sector, unsigned long long byte_offset, unsigned long long byte_len, unsigned long long buf, unsigned int write)
| ~~~~~~~~~~~~~^~~~~
disk_io.c:381:14: warning: array subscript -2 is outside array bounds of ‘unsigned int[1]’ [-Warray-bounds]
381 | byte_len = (unsigned long long)(&write - 5);
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
disk_io.c:371:135: note: while referencing ‘write’
371 | devread (unsigned long long sector, unsigned long long byte_offset, unsigned long long byte_len, unsigned long long buf, unsigned int write)
| ~~~~~~~~~~~~~^~~~~
fsys_fat.c: In function ‘fat_mount’:
fsys_fat.c:236:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
236 | if ((first_fat | 0xF) != (magic | 0xFF))
| ^~
fsys_fat.c:239:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
239 | fats_type = FAT_SUPER->fat_type;
| ^~~~~~~~~
fsys_fat.c:329:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
329 | if (first_fat != 0xfffffff8)
| ^~
fsys_fat.c:332:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
332 | fats_type = FAT_SUPER->fat_type;
| ^~~~~~~~~
fsys_ntfs.c: In function ‘read_data’:
fsys_ntfs.c:847:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
847 | if (dest)
| ^~
fsys_ntfs.c:850:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
850 | disk_read_func = disk_read_hook;
| ^~~~~~~~~~~~~~
fsys_ntfs.c: In function ‘ntfs_read’:
fsys_ntfs.c:1474:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
1474 | if (valueat(cur_mft,0x16,unsigned short) & 2)
| ^~
fsys_ntfs.c:91:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
91 | #define valueat(buf,ofs,type) ((type)(((char)(grub_size_t)buf)+ofs))
| ^
fsys_ntfs.c:130:25: note: in expansion of macro ‘valueat’
130 | #define save_pos valueat(cur_mft,8,unsigned long long)
| ^~~~~~~
fsys_ntfs.c:1476:5: note: in expansion of macro ‘save_pos’
1476 | save_pos=1;
| ^~~~~~~~
In function ‘read_data’,
inlined from ‘read_data’ at fsys_ntfs.c:818:12:
fsys_ntfs.c:103:42: warning: ‘cc.flags’ may be used uninitialized [-Wmaybe-uninitialized]
103 | #define set_rflag(a,b) if (b) ctx->flags|=(a); else ctx->flags&=~(a);
| ^~
fsys_ntfs.c:857:5: note: in expansion of macro ‘set_rflag’
857 | set_rflag(RF_COMP, valueat(pa,0xC,unsigned short) & FLAG_COMPRESSED);
| ^~~~~~~~~
fsys_ntfs.c: In function ‘read_data’:
fsys_ntfs.c:822:14: note: ‘cc’ declared here
822 | read_ctx cc, *ctx;
| ^~
fsys_fb.c: In function ‘fb_dir’:
fsys_fb.c:462:53: warning: taking address of packed member of ‘struct fbm_file’ may result in an unaligned pointer value [-Waddress-of-packed-member]
462 | unsigned long long *a = (unsigned long long *)&cur_file->data_size;
| ^~~~~~~~~~~~~~~~~~~~
stage2.c: In function ‘run_menu’:
stage2.c:1143:9: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
1143 | else
| ^~~~
In file included from stage2.c:20:
./shared.h:1917:26: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
1917 | #define grub_printf(...) grub_sprintf(NULL, VA_ARGS)
| ^~~~~~~~~~~~
stage2.c:1147:33: note: in expansion of macro ‘grub_printf’
1147 | grub_printf("%2d",grub_timeout);
| ^~~~~~~~~~~
stage2.c: In function ‘cmain’:
stage2.c:1921:3: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
1921 | else
| ^~~~
stage2.c:1924:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
1924 | saved_entryno = 0;
| ^~~~~~~~~~~~~
stage2.c:2062:21: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
2062 | if (num_entries >= 256)
| ^~
stage2.c:2064:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
2064 | bt += (CONFIG_ENTRIES[attr] & 1);
| ^~
graphics.c: In function ‘DecodeElement’:
graphics.c:1204:99: warning: right-hand operand of comma expression has no effect [-Wunused-value]
1204 | temp=thiscode-huf_min_value[HufTabIndex][codelen-1]+code_pos_table[HufTabIndex][codelen-1],HufTabIndex;
| ^
/usr/bin/ld: pre_stage2_exec-builtins.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/builtins.c:125: multiple definition of next_partition_partition'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:495: first defined here /usr/bin/ld: pre_stage2_exec-builtins.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/builtins.c:126: multiple definition of
next_partition_type'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:495: first defined here
/usr/bin/ld: pre_stage2_exec-builtins.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/builtins.c:127: multiple definition of next_partition_start'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:495: first defined here /usr/bin/ld: pre_stage2_exec-builtins.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/builtins.c:128: multiple definition of
next_partition_len'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:495: first defined here
/usr/bin/ld: pre_stage2_exec-builtins.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/builtins.c:123: multiple definition of next_partition_drive'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:495: first defined here /usr/bin/ld: pre_stage2_exec-builtins.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/builtins.c:124: multiple definition of
next_partition_dest'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:495: first defined here
/usr/bin/ld: pre_stage2_exec-builtins.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/builtins.c:129: multiple definition of next_partition_offset'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:495: first defined here /usr/bin/ld: pre_stage2_exec-builtins.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/builtins.c:130: multiple definition of
next_partition_entry'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:495: first defined here
/usr/bin/ld: pre_stage2_exec-builtins.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/builtins.c:131: multiple definition of next_partition_ext_offset'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:495: first defined here /usr/bin/ld: pre_stage2_exec-builtins.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/builtins.c:132: multiple definition of
next_partition_buf'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:495: first defined here
/usr/bin/ld: pre_stage2_exec-builtins.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/builtins.c:4303: multiple definition of hotkey_func'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:74: first defined here /usr/bin/ld: pre_stage2_exec-builtins.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/./shared.h:1432: multiple definition of
malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here
/usr/bin/ld: pre_stage2_exec-char_io.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/./shared.h:1432: multiple definition of malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here /usr/bin/ld: pre_stage2_exec-cmdline.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/./shared.h:1432: multiple definition of
malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here
/usr/bin/ld: pre_stage2_exec-common.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/common.c:34: multiple definition of errorcheck'; pre_stage2_exec-cmdline.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/cmdline.c:32: first defined here /usr/bin/ld: pre_stage2_exec-common.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/./shared.h:1432: multiple definition of
malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here
/usr/bin/ld: pre_stage2_exec-console.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/./shared.h:1432: multiple definition of malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here /usr/bin/ld: pre_stage2_exec-dec_lz4.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: multiple definition of
malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here
/usr/bin/ld: pre_stage2_exec-dec_lzma.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: multiple definition of malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here /usr/bin/ld: pre_stage2_exec-dec_vhd.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: multiple definition of
malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here
/usr/bin/ld: pre_stage2_exec-disk_io.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/disk_io.c:179: multiple definition of fsys_type'; pre_stage2_exec-builtins.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/builtins.c:135: first defined here /usr/bin/ld: pre_stage2_exec-disk_io.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/./shared.h:1432: multiple definition of
malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here
/usr/bin/ld: pre_stage2_exec-fsys_ext2fs.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: multiple definition of malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here /usr/bin/ld: pre_stage2_exec-fsys_fat.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/fsys_fat.c:55: multiple definition of
fats_type'; pre_stage2_exec-disk_io.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/disk_io.c:34: first defined here
/usr/bin/ld: pre_stage2_exec-fsys_fat.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: multiple definition of malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here /usr/bin/ld: pre_stage2_exec-fsys_ntfs.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: multiple definition of
malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here
/usr/bin/ld: pre_stage2_exec-fsys_iso9660.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/fsys_iso9660.c:63: multiple definition of iso_type'; pre_stage2_exec-disk_io.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/disk_io.c:35: first defined here /usr/bin/ld: pre_stage2_exec-fsys_iso9660.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: multiple definition of
malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here
/usr/bin/ld: pre_stage2_exec-fsys_pxe.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: multiple definition of malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here /usr/bin/ld: pre_stage2_exec-fsys_ipxe.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: multiple definition of
malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here
/usr/bin/ld: pre_stage2_exec-fsys_fb.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: multiple definition of malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here /usr/bin/ld: pre_stage2_exec-fsys_initrd.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: multiple definition of
malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here
/usr/bin/ld: pre_stage2_exec-gunzip.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: multiple definition of malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here /usr/bin/ld: pre_stage2_exec-md5.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/./shared.h:1432: multiple definition of
malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here
/usr/bin/ld: pre_stage2_exec-stage2.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/stage2.c:1883: multiple definition of CONFIG_ENTRIES'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:495: first defined here /usr/bin/ld: pre_stage2_exec-stage2.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/stage2.c:348: multiple definition of
menu_num_ctrl'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:74: first defined here
/usr/bin/ld: pre_stage2_exec-stage2.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/stage2.c:347: multiple definition of menu_cfg'; pre_stage2_exec-asm.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/asm.S:74: first defined here /usr/bin/ld: pre_stage2_exec-stage2.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/./shared.h:1432: multiple definition of
malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here
/usr/bin/ld: pre_stage2_exec-graphics.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/graphics.c:62: multiple definition of use_phys_base'; pre_stage2_exec-stage2.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/stage2.c:349: first defined here /usr/bin/ld: pre_stage2_exec-graphics.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/./shared.h:1432: multiple definition of
malloc_array_start'; pre_stage2_exec-boot.o:/home/msetzerii/Downloads/grub4dos-16d87ac0446628bc252fce9afdb46e25121879a2/stage2/shared.h:1432: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:612: pre_stage2.exec] Error 1
make[1]: *** [Makefile:373: all-recursive] Error 1
make: *** [Makefile:313: all] Error 2
Download gcc4 8, and then install gcc4 8. Switch to gcc4 8。
Release History
GCC 4.8.5
June 23, 2015
GCC 4.8.4
December 19, 2014
GCC 4.8.3
May 22, 2014
GCC 4.8.2
October 16, 2013
GCC 4.8.1
May 31, 2013
GCC 4.8.0
March 22, 2013
What does going back to a very old version of compiler do to fix issues?
Look at some of the code, and it appeared that was obvious where the code falls, but others had the spacing/tabs all over the place, so I could figure which way the compiler would do it. Seems going to an older compiler that doesn't check things?
Is there a reason why these are reported by the newer compiler but not the older?
Well, beyond my knowledge for a program like this. Just it usually works. Just had a user that couldn't get the grub4dos efi to work on his system that works on mine. Gave him instructions to use the regular grub4dos and believe it worked on his system. Was just looking if it might be something in code I could see. Had another user that got new Dell machines that no longer included BIOS boot option, so had to make an EFI boot option and grub4dos works.
Thanks for your time.