trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Small MIPS fixes
@ 2014-09-19 14:11 Markos Chandras
  2014-09-19 14:11 ` [PATCH 1/2] configure.sh: Respect CFLAGS from the environment Markos Chandras
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Markos Chandras @ 2014-09-19 14:11 UTC (permalink / raw)
  To: trinity; +Cc: Markos Chandras

Hi,

A few fixes for trinity in order to improve the MIPS build. The first
one allows the user to pass extra cflags. The other one renames the
MAP_GLOBAL and MAP_LOCAL definitions in order to avoid conflicts
with the userspace linux headers.

Markos Chandras (2):
  configure.sh: Respect CFLAGS from the environment
  maps: Rename MAP_{GLOBAL, LOCAL} to TRINITY_MAP_{GLOBAL, LOCAL}

 configure.sh    | 4 ++--
 include/maps.h  | 4 ++--
 maps-shared.c   | 2 +-
 maps.c          | 4 ++--
 syscalls/mmap.c | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

-- 
2.1.0

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

* [PATCH 1/2] configure.sh: Respect CFLAGS from the environment
  2014-09-19 14:11 [PATCH 0/2] Small MIPS fixes Markos Chandras
@ 2014-09-19 14:11 ` Markos Chandras
  2014-09-19 14:11 ` [PATCH 2/2] maps: Rename MAP_{GLOBAL, LOCAL} to TRINITY_MAP_{GLOBAL, LOCAL} Markos Chandras
  2014-09-22 13:37 ` [PATCH 0/2] Small MIPS fixes Dave Jones
  2 siblings, 0 replies; 5+ messages in thread
From: Markos Chandras @ 2014-09-19 14:11 UTC (permalink / raw)
  To: trinity; +Cc: Markos Chandras

Currently, configure.sh does not inherit any cflags from the
environment. However, for MIPS, it's necessary to pass additional
cflags to decide, for example, if we want a big endian (-BE) or
little endian (-EL) build. As a result of which, we modify the
configure.sh script to respect additional cflags passed by the
user.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
 configure.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.sh b/configure.sh
index d2a31c266519..98905fb8e7fd 100755
--- a/configure.sh
+++ b/configure.sh
@@ -16,9 +16,9 @@ MISSING_DEFS=0
 # expand tilde
 CC="$(eval echo ${CROSS_COMPILE}${CC})"
 
-CFLAGS=""
+CFLAGS="${CFLAGS}"
 if [ "${SYSROOT}xx" != "xx" ]; then
-	CFLAGS="$(eval echo --sysroot=${SYSROOT} )"
+	CFLAGS="${CFLAGS} $(eval echo --sysroot=${SYSROOT} )"
 fi
 
 echo "#pragma once" > $CONFIGH
-- 
2.1.0

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

* [PATCH 2/2] maps: Rename MAP_{GLOBAL, LOCAL} to TRINITY_MAP_{GLOBAL, LOCAL}
  2014-09-19 14:11 [PATCH 0/2] Small MIPS fixes Markos Chandras
  2014-09-19 14:11 ` [PATCH 1/2] configure.sh: Respect CFLAGS from the environment Markos Chandras
@ 2014-09-19 14:11 ` Markos Chandras
  2014-09-22 13:37 ` [PATCH 0/2] Small MIPS fixes Dave Jones
  2 siblings, 0 replies; 5+ messages in thread
From: Markos Chandras @ 2014-09-19 14:11 UTC (permalink / raw)
  To: trinity; +Cc: Markos Chandras

The MAP_LOCAL flag is actually a valid flag and some architectures
make use of it according to the mmap manpage. More specifically,
MIPS and Xtensa define the MAP_LOCAL flag in their userpsace mman.h
header leading to build problems like this:

In file included from syscalls/mprotect.c:6:0:
include/maps.h:8:0: error: "MAP_LOCAL" redefined [-Werror]
 #define MAP_LOCAL 2
 ^
In file included from syscalls/mprotect.c:4:0:
/toolchain/mips-linux-gnu/libc/usr/include/asm/mman.h:37:0:
note: this is the location of the previous definition
 #define MAP_LOCAL 0x080  /* Copy on fork/sproc */
 ^

Therefore, we rename the definitions in trinity to avoid conflicts
with the linux headers.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
 include/maps.h  | 4 ++--
 maps-shared.c   | 2 +-
 maps.c          | 4 ++--
 syscalls/mmap.c | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/maps.h b/include/maps.h
index 37914ce5e32b..6bfd443eca5f 100644
--- a/include/maps.h
+++ b/include/maps.h
@@ -4,8 +4,8 @@
 
 extern char *page_rand;
 
-#define MAP_GLOBAL 1
-#define MAP_LOCAL 2
+#define TRINITY_MAP_GLOBAL 1
+#define TRINITY_MAP_LOCAL 2
 
 struct map {
 	struct list_head list;
diff --git a/maps-shared.c b/maps-shared.c
index 8e8218619120..57c13541b669 100644
--- a/maps-shared.c
+++ b/maps-shared.c
@@ -43,7 +43,7 @@ static void alloc_zero_map(unsigned long size, int prot, const char *name)
 	newnode->name = strdup(name);
 	newnode->size = size;
 	newnode->prot = prot;
-	newnode->type = MAP_GLOBAL;
+	newnode->type = TRINITY_MAP_GLOBAL;
 	newnode->ptr = mmap(NULL, size, prot, MAP_ANONYMOUS | MAP_SHARED, fd, 0);
 	if (newnode->ptr == MAP_FAILED) {
 		outputerr("mmap failure\n");
diff --git a/maps.c b/maps.c
index f2f1f5c67d12..3cf910ab34cd 100644
--- a/maps.c
+++ b/maps.c
@@ -65,10 +65,10 @@ static void delete_local_mapping(struct map *map)
 /* Called from munmap()'s ->post routine. */
 void delete_mapping(struct map *map)
 {
-	if (map->type == MAP_LOCAL)
+	if (map->type == TRINITY_MAP_LOCAL)
 		delete_local_mapping(map);
 
-	/* Right now, we don't want to delete MAP_GLOBAL mappings */
+	/* Right now, we don't want to delete TRINITY_MAP_GLOBAL mappings */
 }
 
 /* used in several sanitise_* functions. */
diff --git a/syscalls/mmap.c b/syscalls/mmap.c
index 4e1d9b0cabe5..1c342f44d6be 100644
--- a/syscalls/mmap.c
+++ b/syscalls/mmap.c
@@ -94,7 +94,7 @@ static void post_mmap(struct syscallrecord *rec)
 	new->prot = rec->a3;
 //TODO: store fd if !anon
 	new->ptr = p;
-	new->type = MAP_LOCAL;
+	new->type = TRINITY_MAP_LOCAL;
 
 	// Add this to a list for use by subsequent syscalls.
 	list = &this_child->mappings->list;
-- 
2.1.0

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

* Re: [PATCH 0/2] Small MIPS fixes
  2014-09-19 14:11 [PATCH 0/2] Small MIPS fixes Markos Chandras
  2014-09-19 14:11 ` [PATCH 1/2] configure.sh: Respect CFLAGS from the environment Markos Chandras
  2014-09-19 14:11 ` [PATCH 2/2] maps: Rename MAP_{GLOBAL, LOCAL} to TRINITY_MAP_{GLOBAL, LOCAL} Markos Chandras
@ 2014-09-22 13:37 ` Dave Jones
  2014-09-22 13:42   ` Markos Chandras
  2 siblings, 1 reply; 5+ messages in thread
From: Dave Jones @ 2014-09-22 13:37 UTC (permalink / raw)
  To: Markos Chandras; +Cc: trinity

On Fri, Sep 19, 2014 at 03:11:53PM +0100, Markos Chandras wrote:
 > Hi,
 > 
 > A few fixes for trinity in order to improve the MIPS build. The first
 > one allows the user to pass extra cflags. The other one renames the
 > MAP_GLOBAL and MAP_LOCAL definitions in order to avoid conflicts
 > with the userspace linux headers.

both applied and pushed. Apologies for delay, vacation.

	Dave

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

* Re: [PATCH 0/2] Small MIPS fixes
  2014-09-22 13:37 ` [PATCH 0/2] Small MIPS fixes Dave Jones
@ 2014-09-22 13:42   ` Markos Chandras
  0 siblings, 0 replies; 5+ messages in thread
From: Markos Chandras @ 2014-09-22 13:42 UTC (permalink / raw)
  To: Dave Jones; +Cc: trinity

On 09/22/2014 02:37 PM, Dave Jones wrote:
> On Fri, Sep 19, 2014 at 03:11:53PM +0100, Markos Chandras wrote:
>  > Hi,
>  > 
>  > A few fixes for trinity in order to improve the MIPS build. The first
>  > one allows the user to pass extra cflags. The other one renames the
>  > MAP_GLOBAL and MAP_LOCAL definitions in order to avoid conflicts
>  > with the userspace linux headers.
> 
> both applied and pushed. Apologies for delay, vacation.
> 
> 	Dave
> 
Thank you Dave.

-- 
markos

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

end of thread, other threads:[~2014-09-22 13:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-19 14:11 [PATCH 0/2] Small MIPS fixes Markos Chandras
2014-09-19 14:11 ` [PATCH 1/2] configure.sh: Respect CFLAGS from the environment Markos Chandras
2014-09-19 14:11 ` [PATCH 2/2] maps: Rename MAP_{GLOBAL, LOCAL} to TRINITY_MAP_{GLOBAL, LOCAL} Markos Chandras
2014-09-22 13:37 ` [PATCH 0/2] Small MIPS fixes Dave Jones
2014-09-22 13:42   ` Markos Chandras

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 NNTP newsgroup(s).