20 February 2021, 23:38 | #21 |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,959
|
Unfortunelly hunk RELOC32SHORT doesnt works for kick 2.0 too.
Then using RELOC32SHORT hunk as DEFAULT is totally useless for vbcc. Only OPTIONAL kick31 option has minimal sense for me. In general this is useless now (it generates only problems for new Amiga programmers/users). Code optimisation has sense, hunk optimisation has maybe 1% sense. With good code optimisation you have much less hunks too. RELOC32SHORT has sense only if someone want to run executable on kick 3.0+ and dont want to use/add special checking routine for kick 3.0+. |
20 February 2021, 23:47 | #22 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
Thomas: It's on a high level for sure, that's why a flow chart will suffice for the gotchas.
This is a good summary of my original post. Basically what Powerpacker needed through all those versions to finally get it right. Except I just have to load it into memory. I envision a relatively short piece of code with some checks and some LoadSeg() calls, and possibly some handling of exes with the last hunk 0 longword removed to reduce filesize. Currently I check for OS version and either LoadSeg() or use the Run command, but this new piece of code must be self-contained. |
21 February 2021, 00:37 | #23 | |
Registered User
Join Date: Aug 2006
Location: Finland
Age: 51
Posts: 241
|
Quote:
|
|
21 February 2021, 01:07 | #24 | |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
Quote:
|
|
21 February 2021, 02:15 | #25 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Either you or me fail to understand the intention of this thread.
It definitely does! I'm not 100% sure about V36, but V37 (OS2.04) is guaranteed. Quote:
|
|
21 February 2021, 02:30 | #26 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Quote:
Is it just the feature to have a larger hunk-size in the HUNK_HEADER than in the code/data hunk itself (data-bss hunks)? Or is the hunk really shorter than specified in both locations? |
||
21 February 2021, 08:19 | #27 | ||||
Registered User
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,544
|
Quote:
Quote:
Quote:
Quote:
|
||||
21 February 2021, 10:11 | #28 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Quote:
Code:
00000000 00 00 03 F3 00 00 00 00 00 00 00 05 00 00 00 00 ó 00000010 00 00 00 04 00 00 00 01 00 00 00 01 40 00 00 01 @ 00000020 40 00 00 01 40 00 00 02 00 00 03 E9 00 00 00 01 @ @ é 00000030 4E 71 4E 75 00 00 03 F2 00 00 03 EA 00 00 00 01 NqNu ò ê 00000040 12 34 56 78 00 00 03 F2 00 00 03 E9 00 00 00 01 4Vx ò é 00000050 4E 73 4E 73 00 00 03 F2 00 00 03 EA 00 00 00 01 NsNs ò ê 00000060 9A BC DE F0 00 00 03 F2 00 00 03 EB 00 00 00 02 š¼Þð ò ë 00000070 00 00 03 F2 Code:
00000000 00 00 03 F3 00 00 00 00 00 00 00 05 00 00 00 00 ó 00000010 00 00 00 04 00 00 00 01 00 00 00 01 40 00 00 01 @ 00000020 40 00 00 01 40 00 00 02 00 00 03 E9 00 00 00 01 @ @ é 00000030 4E 71 4E 75 00 00 03 EA 00 00 00 01 12 34 56 78 NqNu ê 4Vx 00000040 00 00 03 E9 00 00 00 01 4E 73 4E 73 00 00 03 EA é NsNs ê 00000050 00 00 00 01 9A BC DE F0 00 00 03 EB 00 00 00 02 š¼Þð ë 00000060 00 00 03 F2 |
|
21 February 2021, 10:53 | #29 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,215
|
If loading a binary to memory and performing the relocation is the problem, then LoadSeg() is the solution. Actually, it doesn't strictly speaking. It works, but under the wrong hunk number. HUNK_RELOC32SHORT (under this very ID) only works from 3.0 up. Under 2.0, you need to use this HUNK_ABSRELOC16 or how it is called. This is due to a typo in LoadSeg(). Both hunk types work alike for LoadSeg, though they are intended for something different (or were).
|
21 February 2021, 11:07 | #30 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,215
|
Quote:
|
|
21 February 2021, 11:57 | #31 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,215
|
Unfortunately, if the hunk binary comes from memory, LoadSeg() does not provide a solution under 1.3 and before (it does not go through the buffered I/O functions). You can loadseg from an open stream, though (i.e. loadseg can also operate on a file already open, and there is no need to provide a file name).
Anyhow, whether that matters or not is a matter of the problem statement. |
21 February 2021, 12:11 | #32 | ||||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Quote:
Quote:
Quote:
But if you know the history of HUNK_ABSRELOC16 I would be interested (yes, off-topic). Who had the idea that 16-bit absolute addresses could ever make sense in an AmigaOS executable? |
||||
21 February 2021, 12:29 | #33 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
|
21 February 2021, 13:51 | #34 | ||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,215
|
Quote:
Quote:
Not much. The list of hunk types LoadSeg (as of 3.1 and also as of 3.2) supports is: Code:
HunkName (which is ignored) HunkCode HunkData HunkBss HunkReloc32 HunkReloc16 (triggers an error) HunkReloc8 (triggers an error) HunkExt (triggers an error) HunkSymbol (ignored) HunkDebug (ignored) HunkEnd HunkHeader HunkCont HunkOverlay HunkBreak HunkDRel32 (wors as HunkReloc32short, on error) HunkDRel16 (errors) HunkDRel8 (errors) HunkLib (errors) HunkIndex (errors) HunkReloc32Short (the real one) HunkRelReloc32 (exotic nonsense for relocating bra.l and jmp (offset.l,pc) Concerning HUNK_ABSRELOC16 I can only guess. The hunk type does not show up in the Os sources, and neither in the original tripos code, so it was probably reserved way before that. As you say, it does not generally make sense as even Tripos could not reserve memory exclusively in the first 32K (or last 32K). |
||
21 February 2021, 14:38 | #35 |
Registered User
Join Date: Aug 2006
Location: Finland
Age: 51
Posts: 241
|
|
21 February 2021, 15:16 | #36 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Hi mr.spiv
What do you mean by hunk packers? Hunk merging? Sort of the relocation tables for subsequent delta compression? Anyway picture me interested I am convinced that I wrote dedicated code in the past, but probably lost by long time. |
21 February 2021, 15:47 | #37 | |
Registered User
Join Date: Aug 2006
Location: Finland
Age: 51
Posts: 241
|
Quote:
I recall I stated in some readme that there will a proper "hunk preprocessor" to merge hunks etc in the next release but that never materialized as many of my projects. |
|
21 February 2021, 19:55 | #38 | |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,959
|
Quote:
|
|
21 February 2021, 20:07 | #39 |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,959
|
I dont know what is Photon target. Shortest exe or loading every or some Amiga files from memory.
If shortest exe, he can used other relocation method, f.e Atari ST (some Amiga games used this) or CodeWarrior. If he want to load every Amiga file from memory then LoadSeg is the best solution. But if he want to load only files created by own, then he can use own relocation routine. I used/created my relocation routine for some players, but I always created only one Hunk Amiga exe file. And it was easy to relocation. I can reloc module to chip or fast, dependent to user's choose. |
21 February 2021, 20:33 | #40 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,215
|
Ehem. I just tested, with the v37 ROM. Yes, it does. Note, however, that 0x3f7 is actually not the correct hunk number. It should be 0x3fc, and *that* does not work. This is by error, and v39 supports both, the incorrect, and the correct hunk number. That's because the Os build is based on SAS/C, h68x and SLink, and SLink does not support this hunk type. Actually, when building 3.1.4, I was mostly trying to avoid relocation hunks at all, and tried to create pure and relocatable binaries. That is of course not always possible, but the size of the reloc hunks should be rather small.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ELF Vs Hunk | bloodline | Coders. System | 11 | 23 March 2017 16:32 |
Resourcer supporting OVERLAY hunk???? | CFou! | Coders. General | 1 | 06 March 2017 23:06 |
Titanics - Unknown Hunk | carrion | Coders. General | 3 | 19 December 2016 22:01 |
Amiga Hunk HUNK_RELOC32 | jeremysmith | Coders. System | 6 | 26 February 2016 13:50 |
Bad LoadFile Hunk | amiga | support.Apps | 4 | 26 June 2008 02:31 |
|
|