🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #53627

gcc is subsetting memory objects

#53627
From: Bret Orsburn
Date: Sat, 19 Oct 1991 04:45
58 lines
2023 bytes
Help, Mr. Wizard!!!

I just discovered that gcc (version 1.37.1 for the 68K) object programs feel
free to access a subset of a memory object (e.g. they may contain word opcodes
targeted at long data items).

------------------------------- Example ------------------------------------

main()
{
        long var, *pvar;

        pvar = &var;

        *pvar |= 512;
}

#NO_APP
gcc_compiled.:
.text
        .even
.globl _main
_main:
        link a6,#-8
        movel a6,d1
        subql #4,d1
        movel d1,a6@(-8)
        movel a6@(-8),d0
        movel d0,a0
        orw #512,a0@(2)			<---- Ouch!!!
L1:
        unlk a6
        rts

----------------------------------------------------------------------------

I'm working with a custom memory device that doesn't understand anything
but longword-size and longword-aligned accesses.

I had assumed that I was safe as long as I defined only "legal" memory
objects within this device. (Another assumption bytes the dust :-(

Is there any command-line option or set of options I can use to tell
gcc that subsetting memory objects is not allowed?

(It looks as though -fforce-mem might do this as a side-effect, but the man
page description doesn't guarantee it. If this happens to work, what would
the performance hit be? I have quite a lot of 3rd-party source code that
needs to Do The Right Thing with this device.)

Thanks.

-- 

bret@codonics.com
uunet!codonics!bret            Cartesian uncertainty: cogito ergo sum (cogito)
Bret Orsburn
Technical Details
Message-ID: <6030@codonics.COM>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!codonics!codonics.com!bret

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,57d4a500090d26c3,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1991-10-19 14:55:26 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!codonics!codonics.com!bret
From: bret@codonics.com (Bret Orsburn)
Newsgroups: gnu.gcc.help
Subject: gcc is subsetting memory objects
Message-ID: <6030@codonics.COM>
Date: 19 Oct 91 04:45:36 GMT
Sender: news@codonics.COM
Organization: Codonics Inc.
Lines: 58