-msep-data without -fPIC ?

2006-01-13 Thread Philippe De Muyter
Hello,

For an embedded mmu-less m68k target, I would like to generate code
that will always run at a fixed place in memory, thus not needing to be PIC,
but that would access a data+bss segment that could be anywhere in memory,
thus needing accesses to the data segment via %a5 and an offset table.

1.  Does that possibility already exist in gcc (I did not find it) ?
-msep-data currently does PI-text + PI-data.
2.  If it does not exist, I plan to integrate it.
- From which release or branch should I start ?
  I'd like to work on something that is stable except for my changes.
- How is it currently possible in the gcc internals to know if a
  SYMBOL_REF points to the .text or .rodata segments ?

Philippe


distinguishing .text SYMBOL_REF's from .data SYMBOL_REF's

2006-01-15 Thread Philippe De Muyter
For a mmu-less embedded target, I would like to generate code to run at
a fixed location in read-only memory, but with the data segment located
anywhere in memory.  Therefore, the accesses to the data segement must go
through an indirection table (GOT).

I do not think that the option exists for my target (m68k).

In order to implement it I should be able to distinguish SYMBOL_REF's to
the text+rodata segment from SYMBOL_REF's to the data+bss segment.

Does that already exist ?

Philippe


PATCH[m68k] : ColdFire : Allow addq/subq to memory

2006-01-15 Thread Philippe De Muyter
Although the coldfire's that I know of are able to use addq/subq to memory
operands, gcc refuses to generate those instructions.

Below is a small patch fixing that.

With it, my coldfire-compiled linux kernel shrinks by 3k IIRC.

Feel free to apply.

Best Regards

Philippe

2005-08-26  Philippe De Muyter  <[EMAIL PROTECTED]>

* config/m68k/m68k.md (*addsi3_5200): Allow addq/subq to memory
operands.

--- config/m68k/m68k.md 2005-08-25 10:59:51.0 +0200
+++ config/m68k/m68k.md 2005-08-26 11:24:33.0 +0200
@@ -1861,7 +1887,7 @@
 (define_insn "*addsi3_5200"
   [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,r")
(plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0")
-(match_operand:SI 2 "general_src_operand" "d,rJK,a,mrIKLi")))]
+(match_operand:SI 2 "general_src_operand" 
"dIL,rJK,a,mrIKLi")))]
   "TARGET_COLDFIRE"
   "* return output_addsi3 (operands);")
 



Re: -msep-data without -fPIC ?

2006-01-17 Thread Philippe De Muyter
Gunther Nikl wrote :
> On Sat, Jan 14, 2006 at 02:21:20AM +0100, Philippe De Muyter wrote:
> > For an embedded mmu-less m68k target, I would like to generate code
> > that will always run at a fixed place in memory, thus not needing to be PIC,
> > but that would access a data+bss segment that could be anywhere in memory,
> > thus needing accesses to the data segment via %a5 and an offset table.
> > 
> > 1.  Does that possibility already exist in gcc (I did not find it) ?
> > -msep-data currently does PI-text + PI-data.
> 
> AFAICT, this doesn't exist within mainline GCC. The AmigaOS port (which
> isn't part of the official sources) implements this scheme, either with
> 16bit or 32bit displacements. The latter requires a 68020 or better.
> Note, you need binutils support as well.

Where is that AmigaOS port availaible ?
That seems to be an easier solution.

> 
> > 2.  If it does not exist, I plan to integrate it.
> > - From which release or branch should I start ?
> >   I'd like to work on something that is stable except for my changes.
> 
> You have to use current mainlines sources.
> 
> > - How is it currently possible in the gcc internals to know if a
> >   SYMBOL_REF points to the .text or .rodata segments ?
> 
> The AmigaOS port uses SYMBOL_REF_FLAG to record this information. I believe
> SYMBOL_REF_FLAG is deprecated and there is a newer functionality to achieve
> the same.
> 
> Gunther
> 

Thanks for your answer

Philippe


Re: PATCH[m68k] : ColdFire : Allow addq/subq to memory

2006-01-17 Thread Philippe De Muyter
Andreas Schwab wrote :
> "Philippe De Muyter" <[EMAIL PROTECTED]> writes:
> 
> > * config/m68k/m68k.md (*addsi3_5200): Allow addq/subq to memory
> > operands.
> 
> This is ok, but please send the patch to [EMAIL PROTECTED]
> 
> Andreas.

It is already there :)

http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01551.html

Do you need a resend ?

Philippe


Re: -msep-data without -fPIC ?

2006-01-17 Thread Philippe De Muyter
Gunther Nikl wrote :
> On Tue, Jan 17, 2006 at 01:35:59PM +0100, Philippe De Muyter wrote:

> > Where is that AmigaOS port availaible ?
> > That seems to be an easier solution.
> 
> GCC diffs upto 3.4.0 are available here:
> 
>ftp://ftp.back2roots.org/pub/geekgadgets/amiga/m68k/alpha/gcc/

I have downloaded them, and found the -baserel(32) and -resident(32) options.

That seems to be a good starting point, but is not precisely what I meant.

What I meant is :

.text segment is not pic and is linked for a well known address,
.rodata segment is linked for a fixed address.
Initialized data containing references to the text or rodata
are kept in rodata, as they need no relocation.

data, bss, and initialized data containing references to data or bss
are accessed via a5

Is that available ?

I would like to compile busybox that way, and execute it in place from my
flash, without duplicating in ram for each process what should be
read-only datas.

Philippe

> 
> There is a sourceforge project called "adtools" which is intended to have
> the AmigaOS/68k GCC port. Currently those patches are not integrated yet.
> However, the binutils support is available there.
> 
>http://www.sourceforge.net/projects/adtools/
> 
> Its probably impossible to integrate anything from there into official
> sources because its imposible to tell who participated in developing
> these features.
> 
> Gunther
>