Sakura-IT / SonnetAmiga

Reimplementation of WarpOS supporting Sonnet Crescendo 7200 and other PowerPC PCI cards (mirror of CVS development repository).
MIT License
39 stars 3 forks source link

C executables built with Sonnet-modified WarpOS target still contain non-0x2005 hunks #30

Closed rkujawa closed 8 years ago

rkujawa commented 8 years ago

Currently, C executables linked with Sonnet-modified WarpOS target (sonnet.o instead of warpup.o) still contain two hunks without 0x2005 extended memory attribute.

This can be observed for example, in wosdb. Even though I added a bunch of -hunkattr parameters to vlink.

Investigating, I suspect x.o can be blamed here.

Note hunk 6, 7 below:

$ sonnetrun/a.out wosdb/wosdb 
HUNK_HEADER
    Hunk table size: 9
    First hunk to load: 0
    Last hunk to load: 8
Unaligned read at 15f60!
Unaligned read at 15f60!
HUNK_CODE (0x3e9) hunk number 0 at offset 0x54
    Size: 156 Amiga longwords (624 bytes)
    Flags: Extended mem attributes
        Extended memory attribute: 0x2005
    Relocation: HUNK_DRELOC32 (0x3f7)
HUNK_CODE (0x3e9) hunk number 1 at offset 0x2cc
    Size: 17616 Amiga longwords (70464 bytes)
    Flags: Extended mem attributes
        Extended memory attribute: 0x2005
    Relocation: HUNK_RELOC32 (0x3ec)
HUNK_CODE (0x3e9) hunk number 2 at offset 0x1162c
    Size: 7 Amiga longwords (28 bytes)
    Flags: Extended mem attributes
        Extended memory attribute: 0x2005
    Relocation: HUNK_DRELOC32 (0x3f7)
HUNK_DATA (0x3ea) hunk number 3 at offset 0x1166c
    Size: 829 Amiga longwords (3316 bytes)
    Flags: Extended mem attributes
        Extended memory attribute: 0x2005
    Relocation: HUNK_DRELOC32 (0x3f7)
HUNK_DATA (0x3ea) hunk number 4 at offset 0x12378
    Size: 1349 Amiga longwords (5396 bytes)
    Flags: Extended mem attributes
        Extended memory attribute: 0x2005
    Relocation: HUNK_DRELOC32 (0x3f7)
HUNK_DATA (0x3ea) hunk number 5 at offset 0x13c98
    Size: 116 Amiga longwords (464 bytes)
    Flags: Extended mem attributes
        Extended memory attribute: 0x2005
    Relocation: HUNK_DRELOC32 (0x3f7)
HUNK_DATA (0x3ea) hunk number 6 at offset 0x13f34
    Size: 4 Amiga longwords (16 bytes)
    Flags: None (implied MEMF_PUBLIC)
    Relocation: HUNK_DRELOC32 (0x3f7)
HUNK_DATA (0x3ea) hunk number 7 at offset 0x13fdc
    Size: 6 Amiga longwords (24 bytes)
    Flags: None (implied MEMF_PUBLIC)
    Relocation: HUNK_DRELOC32 (0x3f7)
HUNK_BSS (0x3eb) hunk number 8 at offset 0x14010
    Size: 1996 Amiga longwords (7984 bytes)
    Flags: Extended mem attributes
        Extended memory attribute: 0x2005
    Relocation: HUNK_DRELOC32 (0x3f7)
rkujawa commented 8 years ago

Actually not x.o. Linking with -M shows:

------------------------------
  00000000 .ctors  (size 10)
           00000000 - 00000010 INITEXIT(.ctors)
------------------------------
  00000000 .dtors  (size 18)
           00000000 - 00000018 INITEXIT(.dtors)
------------------------------

These are the culprits, now where are they added...

DvdBoon commented 8 years ago

Automatic constructors/deconstructors are added when using -amigahunk. Or so the vlink docs say. Don't know if that is relevant.

2016-02-04 10:24 GMT+01:00 Radosław Kujawa notifications@github.com:

Actually not x.o. Linking with -M shows:


00000000 .ctors (size 10)

00000000 - 00000010 INITEXIT(.ctors)

00000000 .dtors (size 18)

00000000 - 00000018 INITEXIT(.dtors)

These are the culprits, now where are they added...

— Reply to this email directly or view it on GitHub https://github.com/Sakura-IT/SonnetAmiga/issues/30#issuecomment-179727805 .

rkujawa commented 8 years ago

Constructor/destructors are generated by vlink, but -hunkattr affects only input sections read from the objects that we are linking.

Frank will take a look at applying hunkattr modifications for generated sections as well.

In other words, we'll probably need an updated vlink soon.

DvdBoon commented 8 years ago

What are those sections used for? If there is no PPC access we can leave it at this.

rkujawa commented 8 years ago

Something generated by constructors/destructors in VBCC standard C library. It's likely it will be needed. Frank implemented hunkattr support for this, will try tomorrow vlink snapshot.

rkujawa commented 8 years ago

Fixed in vlink source dated today. Already installed it on the server.

@DvdBoon Can you test whether wosdb packaged in latest sonnet.lha works correctly?

https://sonnet.uguu.waw.pl/jenkins/job/sonnetamiga/87/artifact/sonnet.lha

DvdBoon commented 8 years ago

I see that all the hunks now have $2005 as an attribute. And wosdb works nicely/correctly. Yay for the Altivec update. Now to find a Sonnet G4.