All of lore.kernel.org
 help / color / mirror / Atom feed
* [OpenRISC] [PATCH 0/3] openrisc: various fixes
@ 2017-02-06 14:38 Stafford Horne
  2017-02-06 14:38 ` [OpenRISC] [PATCH 1/3] or1k: Make open reentrant Stafford Horne
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Stafford Horne @ 2017-02-06 14:38 UTC (permalink / raw)
  To: openrisc

Hello,

These are a few patches that have collected in the openrisc newlib
repository on github over the last year.  Most issues were found
when running the gdb test suite as I worked on getting that ready
for upstream.

I am working with Stefan Wallentowitz who has sent openrisc patches
in the past.

Olof Kindgren (1):
  or1k: Make open reentrant

Stafford Horne (2):
  libgloss: or1k: If available call the init for init_array
  libgloss: Remove duplicate definition of environ

 libgloss/or1k/crt0.S     | 6 ++++++
 libgloss/or1k/syscalls.c | 5 +----
 2 files changed, 7 insertions(+), 4 deletions(-)

-- 
2.9.3


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

* [OpenRISC] [PATCH 1/3] or1k: Make open reentrant
  2017-02-06 14:38 [OpenRISC] [PATCH 0/3] openrisc: various fixes Stafford Horne
@ 2017-02-06 14:38 ` Stafford Horne
  2017-02-06 14:38 ` [OpenRISC] [PATCH 2/3] libgloss: or1k: If available call the init for init_array Stafford Horne
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Stafford Horne @ 2017-02-06 14:38 UTC (permalink / raw)
  To: openrisc

From: Olof Kindgren <olof.kindgren@gmail.com>

or1k uses reentrant calls by default, but there was no open_r defined
which caused failure in C++/C code such as:

int main() { std::cout << "test\n";  return 0; }

or

int main() {open(".", 0);}
---
 libgloss/or1k/syscalls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libgloss/or1k/syscalls.c b/libgloss/or1k/syscalls.c
index 690d21a..3e2ad22 100644
--- a/libgloss/or1k/syscalls.c
+++ b/libgloss/or1k/syscalls.c
@@ -124,7 +124,7 @@ _lseek_r(struct _reent *reent, int file, _off_t ptr, int dir)
 }
 
 int
-_open(struct _reent *reent, char *file, int flags, int mode)
+_open_r(struct _reent *reent, const char *file, int flags, int mode)
 {
 	reent->_errno = ENOSYS;
 	return -1;
-- 
2.9.3


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

* [OpenRISC] [PATCH 2/3] libgloss: or1k: If available call the init for init_array
  2017-02-06 14:38 [OpenRISC] [PATCH 0/3] openrisc: various fixes Stafford Horne
  2017-02-06 14:38 ` [OpenRISC] [PATCH 1/3] or1k: Make open reentrant Stafford Horne
@ 2017-02-06 14:38 ` Stafford Horne
  2017-02-06 14:38 ` [OpenRISC] [PATCH 3/3] libgloss: Remove duplicate definition of environ Stafford Horne
  2017-03-15 11:44 ` [OpenRISC] [PATCH 0/3] openrisc: various fixes Stafford Horne
  3 siblings, 0 replies; 7+ messages in thread
From: Stafford Horne @ 2017-02-06 14:38 UTC (permalink / raw)
  To: openrisc

There was an issue revealed in gdb testing where C++ virtual tables
were not getting properly initialized.  This seems to be due to the
c++ global constructors moving from ctors to init_array.

This fix makes sure we call the proper method for initializing the
constructors in all places.
---
 libgloss/or1k/crt0.S | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libgloss/or1k/crt0.S b/libgloss/or1k/crt0.S
index 84adba1..03d7323 100644
--- a/libgloss/or1k/crt0.S
+++ b/libgloss/or1k/crt0.S
@@ -36,6 +36,7 @@
       the obvious things..                                                    */
 /* -------------------------------------------------------------------------- */
 
+#include "newlib.h"
 #include "include/or1k-asm.h"
 #include "include/or1k-sprs.h"
 
@@ -96,6 +97,11 @@ _or1k_exception_stack_size:	.word EXCEPTION_STACK_SIZE
                                                                               */
 /* -------------------------------------------------------------------------- */
 
+#ifdef HAVE_INITFINI_ARRAY
+#define _init	__libc_init_array
+#define _fini	__libc_fini_array
+#endif
+
 #define GPR_BUF_OFFSET(x) (x << 2)
 
 #ifndef __OR1K_MULTICORE__
-- 
2.9.3


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

* [OpenRISC] [PATCH 3/3] libgloss: Remove duplicate definition of environ
  2017-02-06 14:38 [OpenRISC] [PATCH 0/3] openrisc: various fixes Stafford Horne
  2017-02-06 14:38 ` [OpenRISC] [PATCH 1/3] or1k: Make open reentrant Stafford Horne
  2017-02-06 14:38 ` [OpenRISC] [PATCH 2/3] libgloss: or1k: If available call the init for init_array Stafford Horne
@ 2017-02-06 14:38 ` Stafford Horne
  2017-03-15 11:44 ` [OpenRISC] [PATCH 0/3] openrisc: various fixes Stafford Horne
  3 siblings, 0 replies; 7+ messages in thread
From: Stafford Horne @ 2017-02-06 14:38 UTC (permalink / raw)
  To: openrisc

Environ is defined in libgloss and libc:
 - libgloss/or1k/syscalls.c
 - libc/stdlib/environ.c

When linking we sometimes get errors:
or1k-elf-g++ test.o -mnewlib -mboard=or1ksim -lm -o  test
/opt/shorne/software/or1k/lib/gcc/or1k-elf/5.3.0/../../../../or1k-elf/lib/libor1k.a(syscalls.o):(.data+0x0):
multiple definition of `environ'
/opt/shorne/software/or1k/lib/gcc/or1k-elf/5.3.0/../../../../or1k-elf/lib/libc.a(lib_a-environ.o):(.data+0x0):
first defined here
collect2: error: ld returned 1 exit status

This doesnt happen after the fix. Basic things build fine too.
---
 libgloss/or1k/syscalls.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libgloss/or1k/syscalls.c b/libgloss/or1k/syscalls.c
index 3e2ad22..92bff49 100644
--- a/libgloss/or1k/syscalls.c
+++ b/libgloss/or1k/syscalls.c
@@ -56,9 +56,6 @@ _close_r(struct _reent *reent, int fildes)
 	return -1;
 }
 
-char *__env[1] = { 0 };
-char **environ = __env;
-
 int
 _execve_r(struct _reent *reent, const char *name, char * const *argv,
 		char * const *env)
-- 
2.9.3


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

* [OpenRISC] [PATCH 0/3] openrisc: various fixes
  2017-02-06 14:38 [OpenRISC] [PATCH 0/3] openrisc: various fixes Stafford Horne
                   ` (2 preceding siblings ...)
  2017-02-06 14:38 ` [OpenRISC] [PATCH 3/3] libgloss: Remove duplicate definition of environ Stafford Horne
@ 2017-03-15 11:44 ` Stafford Horne
  2017-03-15 21:59   ` Stafford Horne
  2017-03-15 22:10   ` Stafford Horne
  3 siblings, 2 replies; 7+ messages in thread
From: Stafford Horne @ 2017-03-15 11:44 UTC (permalink / raw)
  To: openrisc

Hello,

Any comment on this series?

On Mon, Feb 6, 2017 at 11:38 PM, Stafford Horne <shorne@gmail.com> wrote:
> Hello,
>
> These are a few patches that have collected in the openrisc newlib
> repository on github over the last year.  Most issues were found
> when running the gdb test suite as I worked on getting that ready
> for upstream.
>
> I am working with Stefan Wallentowitz who has sent openrisc patches
> in the past.
>
> Olof Kindgren (1):
>   or1k: Make open reentrant
>
> Stafford Horne (2):
>   libgloss: or1k: If available call the init for init_array
>   libgloss: Remove duplicate definition of environ
>
>  libgloss/or1k/crt0.S     | 6 ++++++
>  libgloss/or1k/syscalls.c | 5 +----
>  2 files changed, 7 insertions(+), 4 deletions(-)
>
> --
> 2.9.3
>

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

* [OpenRISC] [PATCH 0/3] openrisc: various fixes
  2017-03-15 11:44 ` [OpenRISC] [PATCH 0/3] openrisc: various fixes Stafford Horne
@ 2017-03-15 21:59   ` Stafford Horne
  2017-03-15 22:10   ` Stafford Horne
  1 sibling, 0 replies; 7+ messages in thread
From: Stafford Horne @ 2017-03-15 21:59 UTC (permalink / raw)
  To: openrisc

Hello.

Sorry my mistake. Corinna replied that this patch series was pushed.  I
didn't get that mail.

https://sourceware.org/ml/newlib/2017/msg00139.html

On 15 Mar 2017 8:44 p.m., "Stafford Horne" <shorne@gmail.com> wrote:

> Hello,
>
> Any comment on this series?
>
> On Mon, Feb 6, 2017 at 11:38 PM, Stafford Horne <shorne@gmail.com> wrote:
> > Hello,
> >
> > These are a few patches that have collected in the openrisc newlib
> > repository on github over the last year.  Most issues were found
> > when running the gdb test suite as I worked on getting that ready
> > for upstream.
> >
> > I am working with Stefan Wallentowitz who has sent openrisc patches
> > in the past.
> >
> > Olof Kindgren (1):
> >   or1k: Make open reentrant
> >
> > Stafford Horne (2):
> >   libgloss: or1k: If available call the init for init_array
> >   libgloss: Remove duplicate definition of environ
> >
> >  libgloss/or1k/crt0.S     | 6 ++++++
> >  libgloss/or1k/syscalls.c | 5 +----
> >  2 files changed, 7 insertions(+), 4 deletions(-)
> >
> > --
> > 2.9.3
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20170316/147bc975/attachment.html>

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

* [OpenRISC] [PATCH 0/3] openrisc: various fixes
  2017-03-15 11:44 ` [OpenRISC] [PATCH 0/3] openrisc: various fixes Stafford Horne
  2017-03-15 21:59   ` Stafford Horne
@ 2017-03-15 22:10   ` Stafford Horne
  1 sibling, 0 replies; 7+ messages in thread
From: Stafford Horne @ 2017-03-15 22:10 UTC (permalink / raw)
  To: openrisc

On Wed, Mar 15, 2017 at 08:44:34PM +0900, Stafford Horne wrote:
> Hello,
> 
> Any comment on this series?

Sorry, my mistake Corinna replied on this but I missed it.

https://sourceware.org/ml/newlib/2017/msg00139.html

> On Mon, Feb 6, 2017 at 11:38 PM, Stafford Horne <shorne@gmail.com> wrote:
> > Hello,
> >
> > These are a few patches that have collected in the openrisc newlib
> > repository on github over the last year.  Most issues were found
> > when running the gdb test suite as I worked on getting that ready
> > for upstream.
> >
> > I am working with Stefan Wallentowitz who has sent openrisc patches
> > in the past.
> >
> > Olof Kindgren (1):
> >   or1k: Make open reentrant
> >
> > Stafford Horne (2):
> >   libgloss: or1k: If available call the init for init_array
> >   libgloss: Remove duplicate definition of environ
> >
> >  libgloss/or1k/crt0.S     | 6 ++++++
> >  libgloss/or1k/syscalls.c | 5 +----
> >  2 files changed, 7 insertions(+), 4 deletions(-)
> >
> > --
> > 2.9.3
> >

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

end of thread, other threads:[~2017-03-15 22:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-06 14:38 [OpenRISC] [PATCH 0/3] openrisc: various fixes Stafford Horne
2017-02-06 14:38 ` [OpenRISC] [PATCH 1/3] or1k: Make open reentrant Stafford Horne
2017-02-06 14:38 ` [OpenRISC] [PATCH 2/3] libgloss: or1k: If available call the init for init_array Stafford Horne
2017-02-06 14:38 ` [OpenRISC] [PATCH 3/3] libgloss: Remove duplicate definition of environ Stafford Horne
2017-03-15 11:44 ` [OpenRISC] [PATCH 0/3] openrisc: various fixes Stafford Horne
2017-03-15 21:59   ` Stafford Horne
2017-03-15 22:10   ` Stafford Horne

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.