what causes OFF_T/SEG_T to be defined?

Asked by StefanPotyra on 2009-05-15


while trying to test-build faumachine (20090512-1) from debian/unstable, it bails out when trying to link the bios. The problem seems to be that, OFF_T and SEG_T in the bios (node-pc/simulator/bios/) are undefined references:

./gcc.pl "gcc -Wchar-subscripts -Wcomment -Wformat -Wnonnull -Wimplicit-int -Wimplicit-function-declaration -Wimplicit -Wmain -Wmissing-braces -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused-function -Wunused-label -Wunused-variable -Wunused-value -Wuninitialized -Wunknown-pragmas -Wstrict-aliasing -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-noreturn -Wnested-externs -Wredundant-decls -Wno-pointer-sign" -I../../.. --freestanding --no-stack-protector -fstrict-aliasing -Os -fomit-frame-pointer -mpreferred-stack-boundary=2 --freestanding -falign-functions=15 -I. -I.. -I../.. -I../../../lib -DCONFIG_APM_SUPPORT -DCONFIG_MOUSE_SUPPORT -DCONFIG_PCI_SUPPORT -DCONFIG_PNP_SUPPORT -DCONFIG_DMI_SUPPORT -DCONFIG_SMI_SUPPORT -DCONFIG_SMP_SUPPORT -DCONFIG_ACPI_SUPPORT -m32 -Xlinker --whole-archive -T ./bios.lds -static -nostdlib -Xlinker -Map -Xlinker bios.gcc.map -Xlinker --cref -L/usr/lib -L/usr/local/lib -o bios.elf1 libinit_rm.a libinit_early.a librt_rm.a librt_pm.a
libinit_rm.a(libinit_rm_a-pci.o): In function `__LOCAL_libinit_rm_a_pci_o_.L108':
pci.c:(.text+0xa90): undefined reference to `OFF_T'
pci.c:(.text+0xa92): undefined reference to `SEG_T'
pci.c:(.text+0xab3): undefined reference to `OFF_T'
pci.c:(.text+0xab5): undefined reference to `SEG_T'
libinit_rm.a(libinit_rm_a-pci.o): In function `__LOCAL_libinit_rm_a_pci_o_.L114':

Now faumachine uses a particular weird/tricky build system to build the bios, which I tried to track down for bugs. However I don't have any clue so far and the best hint might be the assembly output of libbinit_rm_a-pci.o (stripped down to first undefined reference):

00000a57 <__LOCAL_libinit_rm_a_pci_o_.L108>:
     a57: 67 66 0f b6 54 24 addr16 movzbw 0x24(%si),%dx
     a5d: 13 66 31 adc 0x31(%esi),%esp
     a60: f6 66 81 mulb -0x7f(%esi)
     a63: ff 86 80 13 71 66 incl 0x66711380(%esi)
     a69: 0f b6 e9 movzbl %cl,%ebp
     a6c: 67 66 89 54 24 addr16 mov %dx,0x24(%si)
     a71: 04 75 add $0x75,%al
     a73: 4d dec %ebp
     a74: 67 66 ff 74 24 addr16 pushw 0x24(%si)
     a79: 38 66 b9 cmp %ah,-0x47(%esi)
     a7c: 40 inc %eax
     a7d: 00 00 add %al,(%eax)
     a7f: 00 67 66 add %ah,0x66(%edi)
     a82: ff 74 24 38 pushl 0x38(%esp)
     a86: 66 89 ea mov %bp,%dx
     a89: 67 66 8b 44 24 addr16 mov 0x24(%si),%ax
     a8e: 0c 9a or $0x9a,%al
     a90: 00 00 add %al,(%eax)
     a92: 00 00 add %al,(%eax)
     a94: 66 b9 90 00 mov $0x90,%cx
     a98: 00 00 add %al,(%eax)
     a9a: 66 89 ea mov %bp,%dx
     a9d: 67 66 ff 74 24 addr16 pushw 0x24(%si)
     aa2: 40 inc %eax
     aa3: 67 66 ff 74 24 addr16 pushw 0x24(%si)
     aa8: 40 inc %eax
     aa9: 66 89 c7 mov %ax,%di
     aac: 67 66 8b 44 24 addr16 mov 0x24(%si),%ax
     ab1: 14 9a adc $0x9a,%al
     ab3: 00 00 add %al,(%eax)
     ab5: 00 00 add %al,(%eax)
     ab7: 66 83 c4 10 add $0x10,%sp
     abb: 66 89 c6 mov %ax,%si
     abe: 66 09 fe or %di,%si

still I'm confused: What causes SEG_T/OFF_T references in there and why only there?

Any help/ideas/suggestions would be highly appreciated!


Question information

English Edit question
Ubuntu gcc-4.4 Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
StefanPotyra (sistpoty) said : #1

Aha, preasm_patcher/preasm_proc patches the assembly sources, and doesn't match a function call, resulting in only OFF_T/SEG_T to be defined instead of OFF_T.31/SEG_T.31. Problem solved.