public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: newlib@sourceware.org
Cc: openrisc@lists.librecores.org,	stefan.wallentowitz@posteo.de,
	Stafford Horne <shorne@gmail.com>
Subject: [PATCH 3/3] libgloss: Remove duplicate definition of environ
Date: Mon, 06 Feb 2017 14:39:00 -0000	[thread overview]
Message-ID: <ac05ff603f3fc6ba605191dd6a3960c8c68c1da4.1486391219.git.shorne@gmail.com> (raw)
In-Reply-To: <cover.1486391219.git.shorne@gmail.com>
In-Reply-To: <cover.1486391219.git.shorne@gmail.com>

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

  parent reply	other threads:[~2017-02-06 14:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06 14:38 [PATCH 0/3] openrisc: various fixes Stafford Horne
2017-02-06 14:39 ` [PATCH 1/3] or1k: Make open reentrant Stafford Horne
2017-02-06 14:39 ` Stafford Horne [this message]
2017-02-06 14:39 ` [PATCH 2/3] libgloss: or1k: If available call the init for init_array Stafford Horne
2017-02-13  8:20 ` [PATCH 0/3] openrisc: various fixes Corinna Vinschen
2017-03-15 11:44 ` Stafford Horne
2017-03-15 22:10   ` Stafford Horne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac05ff603f3fc6ba605191dd6a3960c8c68c1da4.1486391219.git.shorne@gmail.com \
    --to=shorne@gmail.com \
    --cc=newlib@sourceware.org \
    --cc=openrisc@lists.librecores.org \
    --cc=stefan.wallentowitz@posteo.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).