Chameleon

Issue 296: Compile Error - ${DATA_PAD} is not calculated

Reported by Konstantinos Giannakas, Nov 1, 2012

I am facing a compilation error on revision 2113, on 10.6.8 with 
Xcode's gcc version 4.2.1 (Apple Inc. build 5666). Here is the 
output, please let me know if you need any further information:

imac:chameleon Konsti$ make
	[MKDIR] /Volumes/Workbench/Programming/assembla/chameleon/sym
	[MKDIR] /Volumes/Workbench/Programming/assembla/chameleon/obj
================= Making all in i386 =================
	[MKDIR] /Volumes/Workbench/Programming/assembla/chameleon/sym/i386
	[MKDIR] 
/Volumes/Workbench/Programming/assembla/chameleon/obj/i386/modules
================= Making all in KernelPatcher =================
================= Making all in klibc =================
================= Making all in uClibcxx =================
================= Making all in Resolution =================
================= Making all in Keylayout =================
================= Making all in layouts =================
	[MKDIR] 
/Volumes/Workbench/Programming/assembla/chameleon/obj/i386/util
	[CC32] cham-mklayout.c
	[CC64] cham-mklayout.c
	[LD32] cham-mklayout_32
	[LD64] cham-mklayout_64
	[LIPO] cham-mklayout
	[LAYOUT] Creating keyboard layout: mac-de
	[LAYOUT] Creating keyboard layout: mac-es
	[LAYOUT] Creating keyboard layout: mac-fr
	[LAYOUT] Creating keyboard layout: mac-it
	[LAYOUT] Creating keyboard layout: mac-se
	[LAYOUT] Creating keyboard layout: pc-fr
================= Making all in util =================
	[CC32] dyldsymboltool.c
	[CC64] dyldsymboltool.c
	[CC32] machOconv.c
	[CC64] machOconv.c
	[CC32] segsize.c
	[CC64] segsize.c
	[CC32] bdmesg.c
	[CC64] bdmesg.c
	[LD32] machOconv_32
	[LD64] machOconv_64
	[LIPO] machOconv
	[LD32] dyldsymboltool_32
	[LD64] dyldsymboltool_64
	[LIPO] dyldsymboltool
	[LD32] segsize_32
	[LD64] segsize_64
	[LIPO] segsize
	[LD32] bdmesg_32
	[LD64] bdmesg_64
	[LIPO] bdmesg
================= Making all in fdisk =================
	[MKDIR] 
/Volumes/Workbench/Programming/assembla/chameleon/obj/i386/util/fdisk

	[CC32] cmd.c
	[CC32] disk.c
	[CC32] fdisk.c
	[CC32] getrawpartition.c
	[CC32] mbr.c
	[CC32] misc.c
	[CC32] opendev.c
	[CC32] part.c
	[CC32] user.c
	[CC32] auto.c
	[CC64] cmd.c
	[CC64] disk.c
	[CC64] fdisk.c
	[CC64] getrawpartition.c
	[CC64] mbr.c
	[CC64] misc.c
	[CC64] opendev.c
	[CC64] part.c
	[CC64] user.c
	[CC64] auto.c
	[LD32] 
/Volumes/Workbench/Programming/assembla/chameleon/sym/i386/fdisk440_3
2
	[LD64] 
/Volumes/Workbench/Programming/assembla/chameleon/sym/i386/fdisk440_6
4
	[LIPO] 
/Volumes/Workbench/Programming/assembla/chameleon/sym/i386/fdisk440
================= Making all in klibc =================
	[MKDIR] 
/Volumes/Workbench/Programming/assembla/chameleon/obj/i386/klibc
	[CC] strlcpy.c
	[RM] 
/Volumes/Workbench/Programming/assembla/chameleon/sym/i386/libklibc.a

	[AR] libklibc.a
	[RANLIB] libklibc.a
================= Making all in libsa =================
	[MKDIR] 
/Volumes/Workbench/Programming/assembla/chameleon/obj/i386/libsa
	[CC] prf.c
	[CC] printf.c
	[CC] zalloc.c
	[CC] string.c
	[CC] strtol.c
	[CC] error.c
	[AS] setjmp.s
	[CC] qsort.c
	[CC] efi_tables.c
	[RM] 
/Volumes/Workbench/Programming/assembla/chameleon/sym/i386/libsa.a
	[AR] libsa.a
	[RANLIB] libsa.a
================= Making all in libsaio =================
	[MKDIR] 
/Volumes/Workbench/Programming/assembla/chameleon/obj/i386/libsaio
	[CC] table.c
	[AS] asm.s
	[AS] bios.s
	[CC] biosfn.c
	[CC] disk.c
	[CC] sys.c
	[CC] cache.c
	[CC] bootstruct.c
	[CC] stringTable.c
	[CC] load.c
	[CC] pci.c
	[CC] allocate.c
	[CC] misc.c
	[CC] befs.c
	[CC] freebsd.c
	[CC] openbsd.c
	[CC] vbe.c
	[CC] nbp.c
	[CC] hfs.c
	[CC] hfs_compare.c
	[CC] xml.c
	[CC] ntfs.c
	[CC] msdos.c
	[CC] md5c.c
	[CC] device_tree.c
	[CC] cpu.c
	[CC] platform.c
	[CC] acpi_patcher.c
	[CC] smbios.c
	[CC] smbios_getters.c
	[CC] smbios_decode.c
	[CC] fake_efi.c
	[CC] ext2fs.c
	[CC] hpet.c
	[CC] dram_controllers.c
	[CC] spd.c
	[CC] usb.c
	[CC] pci_setup.c
	[CC] device_inject.c
	[CC] nvidia_helper.c
	[CC] nvidia.c
	[CC] ati.c
	[CC] gma.c
	[CC] pci_root.c
	[CC] convert.c
	[CC] aml_generator.c
	[CC] console.c
	[CC] exfat.c
	[RM] 
/Volumes/Workbench/Programming/assembla/chameleon/sym/i386/libsaio.a

	[AR] libsaio.a
	[RANLIB] libsaio.a
================= Making all in boot0 =================
	[NASM] boot0
	[NASM] boot0hfs
	[NASM] boot0md
	[NASM] chain0
================= Making all in boot1 =================
	[NASM] boot1hp
	[NASM] boot1f32
	[NASM] boot1h
	[NASM] boot1he
================= Making all in boot2 =================
	[MKDIR] 
/Volumes/Workbench/Programming/assembla/chameleon/obj/i386/boot2
	[AS] boot2.s
	[CC] boot.c
	[CC] graphics.c
	[CC] drivers.c
	[CC] prompt.c
	[CC] options.c
	[CC] lzss.c
	[CC] mboot.c
	[CC] ramdisk.c
	[CC] picopng.c
	[CC] resume.c
	[CC] bmdecompress.c
	[CC] graphic_utils.c
	[CC] gui.c
	[CC] modules.c
	[AS] modules_support.s
	[CC] 
/Volumes/Workbench/Programming/assembla/chameleon/sym/i386/boot_modul
es.c
	[LD] boot.sys
	[dyldsymboltool] Symbols.dylib
	[LD] boot.sys
ld: warning: -segaddr __INIT not page aligned, rounding down
ld: warning: -segaddr __TEXT not page aligned, rounding down
ld: warning: -segaddr __DATA not page aligned, rounding down
ld: segments overlap: __DATA (0x0005DFFE + 0x0000F000) and 
__LINKEDIT (0x0005E000 + 0x00001000)
collect2: ld returned 1 exit status
make[3]: *** [boot] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
imac:chameleon Konsti$

Comment 1 by Evan Lojewski, Nov 2, 2012

This issue is due to the spacing between __TEXT and __DATA currently 
being hardcoded in teh variable ${DATA_PAD}. This value needs to be 
calculated at compile time.

For a temporary fix, you can increase the size of DATA_PAD in the 
boot2 Makefile.
Labels: Priority:High Maintainability Priority:Medium
Status: Accepted
Summary: Compile Error - ${DATA_PAD} is not calculated
Owner: meklort

Comment 2 by Konstantinos Giannakas, Nov 4, 2012

Thanks Evan, original value in file i386/boot2/Makefile was DATA_PAD 
= 3582 and it only passes this error with random higher value of 
e.g. 3584 (don't even know what a proper value is) but I still can't 
compile. Produces another error:

================= Making all in boot2 =================
	[CC] 
/Volumes/Workbench/Programming/assembla/chameleon/sym/i386/boot_modul
es.c
	[LD] boot.sys
	[dyldsymboltool] Symbols.dylib
	[LD] boot.sys
ld: warning: -segaddr __INIT not page aligned, rounding down
ld: warning: -segaddr __TEXT not page aligned, rounding down
ld: image too large: address can't fit in 31-bit r_address field in 
boot2 from /chameleon/obj/i386/boot2/boot2.o
collect2: ld returned 1 exit status
make[3]: *** [boot] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Any idea? Thanks again.

Comment 3 by Konstantinos Giannakas, Nov 13, 2012

Hello meklort and chameleon team.
Just updated all files to revision svn2118 and did a clean 
recompilation, but still fails to compile. Any ideas? The trick to 
change the value in ${DATA_PAD} did not work... Still running 10.6.8 
and gcc version 4.2.1 (Apple Inc. build 5666) (dot 3).
Thanks. 


================= Making all in boot2 =================
	[MKDIR] 
/Volumes/Workbench/Programming/assembla/chameleon/obj/i386/boot2
	[AS] boot2.s
	[CC] boot.c
	[CC] graphics.c
	[CC] drivers.c
	[CC] prompt.c
	[CC] options.c
	[CC] lzss.c
	[CC] mboot.c
	[CC] ramdisk.c
	[CC] picopng.c
	[CC] resume.c
	[CC] bmdecompress.c
	[CC] graphic_utils.c
	[CC] gui.c
	[CC] modules.c
	[AS] modules_support.s
	[CC] 
/Volumes/Workbench/Programming/assembla/chameleon/sym/i386/boot_modul
es.c
	[LD] boot.sys
	[dyldsymboltool] Symbols.dylib
	[LD] boot.sys
ld: warning: -segaddr __INIT not page aligned, rounding down
ld: warning: -segaddr __TEXT not page aligned, rounding down
ld: warning: -segaddr __DATA not page aligned, rounding down
ld: segments overlap: __DATA (0x0005DFFE + 0x0000F000) and 
__LINKEDIT (0x0005E000 + 0x00001000)
collect2: ld returned 1 exit status
make[3]: *** [boot] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Comment 4 by Gabriel Somlo, Jan 21, 2013

Hi, I'm encountering the same problem with rev. 2168 (trunk and 
tags/2.1). Increasing DATA_PAD from its current value of 3582 by 1 
to 3583 generates the same error message. Increasing by 2 or more 
(to anything greater than or equal to 3584) results in

ld: warning: -segaddr __INIT not page aligned, rounding down
ld: warning: -segaddr __TEXT not page aligned, rounding down
ld: image too large: address can't fit in 31-bit r_address field in 
boot2 from /Users/foo/Desktop/Chameleon/trunk/obj/i386/boot2/boot2.o

instead of the previous "ld: segments overlap" error.

Please help, I'm also on up-to-date SnowLeopard (10.6.8) with Xcode 
3.2.6 (1761) (whatever shipped with 10.6 plus most recent software 
updates applied). Same gcc version as original poster.

Thanks !

Created: 1 year 11 months ago by Konstantinos Giannakas

Updated: 1 year 8 months ago

Status: Accepted

Owner: Evan Lojewski

Followed by: 1 person

Labels:
Type:Defect
Priority:High
Other:Maintainability