Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch/testcase] gdb.asm/m32r.inc: fix compile error
@ 2003-08-04  6:22 Kei Sakamoto
  2003-08-05 18:02 ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Kei Sakamoto @ 2003-08-04  6:22 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 487 bytes --]

Thank you, everyone. Now m32r is back! :-)

The attached fixes compile errors of asm-source.exp for m32r-elf.
There are several missing symbols.

It also replaces ld24 instruction with seth/add3 instruction.
ld24 can handle only 24bit address, so ld24 fails to set sp when
_stack is located at a large address.

Kei Sakamoto

===

2003-08-04    Kei Sakamoto  <sakamoto.kei@renesas.com>

* gdb.asm/m32r.inc : Add several missing symbols. Replace ld24
                     with seth/add3.

[-- Attachment #2: diffs --]
[-- Type: application/octet-stream, Size: 663 bytes --]

diff -Npur src/gdb/testsuite/gdb.asm/m32r.inc src.orig/gdb/testsuite/gdb.asm/m32r.inc
--- src/gdb/testsuite/gdb.asm/m32r.inc	2003-08-04 13:10:12.000000000 +0900
+++ src.orig/gdb/testsuite/gdb.asm/m32r.inc	2001-11-22 10:13:10.000000000 +0900
@@ -30,22 +30,6 @@
 
 	comment "crt0 startup"
 	.macro gdbasm_startup
-	seth sp, #shigh(_stack)
-	add3 sp, sp, #low(_stack)
+	ld24 sp,_stack
 	ldi fp,#0
 	.endm
-
-	.weak _exit
-gdbasm_declare _exit
-	.weak _kill
-gdbasm_declare _kill
-	.weak _write
-gdbasm_declare _write
-	.weak _sbrk
-gdbasm_declare _sbrk
-	.weak _getpid
-gdbasm_declare _getpid
-	.weak _stack
-gdbasm_declare _stack
-	nop
-

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch/testcase] gdb.asm/m32r.inc: fix compile error
  2003-08-04  6:22 [patch/testcase] gdb.asm/m32r.inc: fix compile error Kei Sakamoto
@ 2003-08-05 18:02 ` Daniel Jacobowitz
  2003-08-06  1:45   ` Kei Sakamoto
  2003-08-07  4:17   ` Andrew Cagney
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2003-08-05 18:02 UTC (permalink / raw)
  To: Kei Sakamoto; +Cc: gdb-patches

On Mon, Aug 04, 2003 at 03:26:03PM +0900, Kei Sakamoto wrote:
> Thank you, everyone. Now m32r is back! :-)
> 
> The attached fixes compile errors of asm-source.exp for m32r-elf.
> There are several missing symbols.
> 
> It also replaces ld24 instruction with seth/add3 instruction.
> ld24 can handle only 24bit address, so ld24 fails to set sp when
> _stack is located at a large address.
> 
> Kei Sakamoto
> 
> ===
> 
> 2003-08-04    Kei Sakamoto  <sakamoto.kei@renesas.com>
> 
> * gdb.asm/m32r.inc : Add several missing symbols. Replace ld24
>                      with seth/add3.

Two minor things:
  - You accidentally sent a reversed diff.
  - ChangeLog formatting.  It should be:

2003-08-04  Kei Sakamoto  <sakamoto.kei@renesas.com>

	* gdb.asm/m32r.inc: Add several missing symbols. Replace ld24
	with seth/add3.

One less minor thing: no other port needs to declare symbols.  It looks
like part of libc is being dragged in somehow on m32r; could you
explain why the symbols are necessary?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch/testcase] gdb.asm/m32r.inc: fix compile error
  2003-08-05 18:02 ` Daniel Jacobowitz
@ 2003-08-06  1:45   ` Kei Sakamoto
  2003-08-06  6:08     ` Doug Evans
  2003-08-06 13:04     ` Daniel Jacobowitz
  2003-08-07  4:17   ` Andrew Cagney
  1 sibling, 2 replies; 8+ messages in thread
From: Kei Sakamoto @ 2003-08-06  1:45 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

> Two minor things:
>   - You accidentally sent a reversed diff.
>   - ChangeLog formatting.  It should be:
>
> 2003-08-04  Kei Sakamoto  <sakamoto.kei@renesas.com>
>
> * gdb.asm/m32r.inc: Add several missing symbols. Replace ld24
> with seth/add3.

Sorry about that.

> One less minor thing: no other port needs to declare symbols.  It looks
> like part of libc is being dragged in somehow on m32r; could you
> explain why the symbols are necessary?

asm-source is compiled with -nostartfiles. So gcc does not use libgloss.a.
But on m32r, somehow several system calls, _write, etc., are included
in it. So it is necessary to declare these symbols. On other architectures,
these system calls are included in libc.a, which is not removed
by -nostartfiles.

Unfortunately, I don't know why m32r's libgloss is different from others.
Should I modify libgloss and newlib rather than declare symbols in m32r.inc?

Kei Sakamoto


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch/testcase] gdb.asm/m32r.inc: fix compile error
  2003-08-06  1:45   ` Kei Sakamoto
@ 2003-08-06  6:08     ` Doug Evans
  2003-08-06 13:04     ` Daniel Jacobowitz
  1 sibling, 0 replies; 8+ messages in thread
From: Doug Evans @ 2003-08-06  6:08 UTC (permalink / raw)
  To: Kei Sakamoto; +Cc: Daniel Jacobowitz, gdb-patches, newlib

Kei Sakamoto writes:
 > > Two minor things:
 > >   - You accidentally sent a reversed diff.
 > >   - ChangeLog formatting.  It should be:
 > >
 > > 2003-08-04  Kei Sakamoto  <sakamoto.kei@renesas.com>
 > >
 > > * gdb.asm/m32r.inc: Add several missing symbols. Replace ld24
 > > with seth/add3.
 > 
 > Sorry about that.
 > 
 > > One less minor thing: no other port needs to declare symbols.  It looks
 > > like part of libc is being dragged in somehow on m32r; could you
 > > explain why the symbols are necessary?
 > 
 > asm-source is compiled with -nostartfiles. So gcc does not use libgloss.a.
 > But on m32r, somehow several system calls, _write, etc., are included
 > in it. So it is necessary to declare these symbols. On other architectures,
 > these system calls are included in libc.a, which is not removed
 > by -nostartfiles.
 > 
 > Unfortunately, I don't know why m32r's libgloss is different from others.
 > Should I modify libgloss and newlib rather than declare symbols in m32r.inc?

Imagine wanting to use libc in multiple environments,
the only difference between them is how the "board support package"
works.  There isn't necessarily one way that systems in which
a particular chip is placed implements system calls (for example).
Does one provide separate libc's for each?
Or does one factor out the board level issues from libc
and keep them separate.

This is how newlib+libgloss is intended to work.
It doesn't on some targets for various reasons.
For some older ports libgloss may not have existed at the time.

Thus, IMO, no you don't want to move libgloss into newlib.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch/testcase] gdb.asm/m32r.inc: fix compile error
  2003-08-06  1:45   ` Kei Sakamoto
  2003-08-06  6:08     ` Doug Evans
@ 2003-08-06 13:04     ` Daniel Jacobowitz
  2003-08-07  2:20       ` Kei Sakamoto
  1 sibling, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2003-08-06 13:04 UTC (permalink / raw)
  To: Kei Sakamoto; +Cc: gdb-patches

On Wed, Aug 06, 2003 at 10:48:46AM +0900, Kei Sakamoto wrote:
> > Two minor things:
> >   - You accidentally sent a reversed diff.
> >   - ChangeLog formatting.  It should be:
> >
> > 2003-08-04  Kei Sakamoto  <sakamoto.kei@renesas.com>
> >
> > * gdb.asm/m32r.inc: Add several missing symbols. Replace ld24
> > with seth/add3.
> 
> Sorry about that.
> 
> > One less minor thing: no other port needs to declare symbols.  It looks
> > like part of libc is being dragged in somehow on m32r; could you
> > explain why the symbols are necessary?
> 
> asm-source is compiled with -nostartfiles. So gcc does not use libgloss.a.
> But on m32r, somehow several system calls, _write, etc., are included
> in it. So it is necessary to declare these symbols. On other architectures,
> these system calls are included in libc.a, which is not removed
> by -nostartfiles.
> 
> Unfortunately, I don't know why m32r's libgloss is different from others.
> Should I modify libgloss and newlib rather than declare symbols in m32r.inc?

-nostartfiles should prevent the inclusion of crt* but not of libgloss;
libgloss is a matter for -nostdlib, which we _don't_ use.  I see that
in the m32r GCC port, -lgloss is in ENDFILE_CPU_SPEC, which is unlike
any other port.

I don't want to mess with that right now, but does adding -lgloss to
${link-flags} in asm-source.exp fix the problem?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch/testcase] gdb.asm/m32r.inc: fix compile error
  2003-08-06 13:04     ` Daniel Jacobowitz
@ 2003-08-07  2:20       ` Kei Sakamoto
  2003-08-07  4:06         ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Kei Sakamoto @ 2003-08-07  2:20 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

> -nostartfiles should prevent the inclusion of crt* but not of libgloss;
> libgloss is a matter for -nostdlib, which we _don't_ use.  I see that
> in the m32r GCC port, -lgloss is in ENDFILE_CPU_SPEC, which is unlike
> any other port.
> 
> I don't want to mess with that right now, but does adding -lgloss to
> ${link-flags} in asm-source.exp fix the problem?

It worked. I removed the declarations of symbols from the patch.

By the way, I noticed another bug in m32r.inc. In m32r.inc, there is
a sequential nop after bl instruction, which is illegal. M32r simulator
doesn't care about it, but real m32r chips cause exceptions.
The attached new patch  fixes this problem too.

Kei

===

2003-08-07    Kei Sakamoto  <sakamoto.kei@renesas.com>

* gdb.asm/asm-source.exp : Add -lgloss to link-flags.
* gdb.asm/m32r.inc : Remove an illegal nop after bl instruction.
Replace ld24 with seth/add3.

[-- Attachment #2: diffs --]
[-- Type: application/octet-stream, Size: 1022 bytes --]

diff -Naur src.orig/gdb/testsuite/gdb.asm/asm-source.exp src/gdb/testsuite/gdb.asm/asm-source.exp
--- src.orig/gdb/testsuite/gdb.asm/asm-source.exp	2003-07-16 02:23:32.000000000 +0900
+++ src/gdb/testsuite/gdb.asm/asm-source.exp	2003-08-07 10:11:20.000000000 +0900
@@ -69,6 +69,7 @@
     }
     "m32r*-*" {
         set asm-arch m32r
+        set link-flags "-Wl,--whole-archive -lgloss -Wl,--no-whole-archive"
     }
     "m6811-*-*" {
         set asm-arch m68hc11
diff -Naur src.orig/gdb/testsuite/gdb.asm/m32r.inc src/gdb/testsuite/gdb.asm/m32r.inc
--- src.orig/gdb/testsuite/gdb.asm/m32r.inc	2001-11-22 10:13:10.000000000 +0900
+++ src/gdb/testsuite/gdb.asm/m32r.inc	2003-08-07 11:05:13.000000000 +0900
@@ -11,7 +11,7 @@
 	.endm
 
 	.macro gdbasm_call subr
-	bl	\subr -> nop
+	bl	\subr
 	.endm
 
 	.macro gdbasm_several_nops
@@ -30,6 +30,7 @@
 
 	comment "crt0 startup"
 	.macro gdbasm_startup
-	ld24 sp,_stack
+	seth sp, #shigh(_stack)
+	add3 sp, sp, #low(_stack)
 	ldi fp,#0
 	.endm

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch/testcase] gdb.asm/m32r.inc: fix compile error
  2003-08-07  2:20       ` Kei Sakamoto
@ 2003-08-07  4:06         ` Daniel Jacobowitz
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2003-08-07  4:06 UTC (permalink / raw)
  To: gdb-patches

On Thu, Aug 07, 2003 at 11:22:02AM +0900, Kei Sakamoto wrote:
> > -nostartfiles should prevent the inclusion of crt* but not of libgloss;
> > libgloss is a matter for -nostdlib, which we _don't_ use.  I see that
> > in the m32r GCC port, -lgloss is in ENDFILE_CPU_SPEC, which is unlike
> > any other port.
> > 
> > I don't want to mess with that right now, but does adding -lgloss to
> > ${link-flags} in asm-source.exp fix the problem?
> 
> It worked. I removed the declarations of symbols from the patch.
> 
> By the way, I noticed another bug in m32r.inc. In m32r.inc, there is
> a sequential nop after bl instruction, which is illegal. M32r simulator
> doesn't care about it, but real m32r chips cause exceptions.
> The attached new patch  fixes this problem too.
> 
> Kei
> 
> ===
> 
> 2003-08-07    Kei Sakamoto  <sakamoto.kei@renesas.com>
> 
> * gdb.asm/asm-source.exp : Add -lgloss to link-flags.
> * gdb.asm/m32r.inc : Remove an illegal nop after bl instruction.
> Replace ld24 with seth/add3.

Thanks, this is OK - I've checked it in.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch/testcase] gdb.asm/m32r.inc: fix compile error
  2003-08-05 18:02 ` Daniel Jacobowitz
  2003-08-06  1:45   ` Kei Sakamoto
@ 2003-08-07  4:17   ` Andrew Cagney
  1 sibling, 0 replies; 8+ messages in thread
From: Andrew Cagney @ 2003-08-07  4:17 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Kei Sakamoto, gdb-patches

> On Mon, Aug 04, 2003 at 03:26:03PM +0900, Kei Sakamoto wrote:
> 
>> Thank you, everyone. Now m32r is back! :-)
>> 
>> The attached fixes compile errors of asm-source.exp for m32r-elf.
>> There are several missing symbols.
>> 
>> It also replaces ld24 instruction with seth/add3 instruction.
>> ld24 can handle only 24bit address, so ld24 fails to set sp when
>> _stack is located at a large address.
>> 
>> Kei Sakamoto
>> 
>> ===
>> 
>> 2003-08-04    Kei Sakamoto  <sakamoto.kei@renesas.com>
>> 
>> * gdb.asm/m32r.inc : Add several missing symbols. Replace ld24
>>                      with seth/add3.
> 
> 
> Two minor things:
>   - You accidentally sent a reversed diff.
>   - ChangeLog formatting.  It should be:
> 
> 2003-08-04  Kei Sakamoto  <sakamoto.kei@renesas.com>
> 
> 	* gdb.asm/m32r.inc: Add several missing symbols. Replace ld24
> 	with seth/add3.
> 
> One less minor thing: no other port needs to declare symbols.  It looks
> like part of libc is being dragged in somehow on m32r; could you
> explain why the symbols are necessary?

This, I suspect is a hangover from an historic foobar that no ones gone 
back to fix.  The original assembler tests used AS and LD making for a 
very raw test framework.  It was an intentional decision, very like the 
simulator tests, rely on an absolute minimum to get things working.

Unfortunatly, sometime back a change switched LD to GCC but at the time 
no one realised (or those reviewing remembered gdb.asm's intent). 
Anyway, it needs to be switched back and that isn't going to be pleasant ...

Andrew



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-08-07  4:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-04  6:22 [patch/testcase] gdb.asm/m32r.inc: fix compile error Kei Sakamoto
2003-08-05 18:02 ` Daniel Jacobowitz
2003-08-06  1:45   ` Kei Sakamoto
2003-08-06  6:08     ` Doug Evans
2003-08-06 13:04     ` Daniel Jacobowitz
2003-08-07  2:20       ` Kei Sakamoto
2003-08-07  4:06         ` Daniel Jacobowitz
2003-08-07  4:17   ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox