BartmanAbyss / vscode-amiga-debug

One-stop Visual Studio Code Extension to compile, debug and profile Amiga C/C++ programs compiled by the bundled gcc 12.2 with the bundled WinUAE/FS-UAE.
GNU General Public License v3.0
303 stars 38 forks source link

Memory types in code sections #215

Closed grahambates closed 1 year ago

grahambates commented 1 year ago

On a recent project I had a need to put my code in chip RAM (I have my reasons!). What I found was:

Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         000002e8  00000000  00000000  00002000  2**1
Idx Name                Size      VMA       LMA       File off  Algn
  0 something.MEMF_CHIP 000002e8  80000074  80000074  00000074  2**1

We could just adjust for this offset but I feel like I'm a bit out of my depth in that I don't really understand the behaviour around the .text name in GCC and I'd be interested to hear your thoughts.

grahambates commented 1 year ago

As it turns out, the very simple solution for my use case is to not have a linker step and just use the vasm elf output directly, as I only have a single object. This leaves the section name intact and doesn't have the problem with VMA.

It would still be good to think about how to deal with code memory types in a larger program though.

BartmanAbyss commented 1 year ago
grahambates commented 1 year ago

Ok that makes sense. I suppose it's a pretty niche requirement anyway! For me it was for creating an exe preview of a bootblock intro where I'm using pc-relative references to copper and audio data. Skipping the linker works fine for this.