diff options
author | Eugene Tarassov | 2018-01-05 18:57:14 +0000 |
---|---|---|
committer | Eugene Tarassov | 2018-01-07 19:32:53 +0000 |
commit | 94ea1ab5da15528dab5f57f43dc350a01f46528b (patch) | |
tree | 70dcff4a092b99570a92b80d3c1448a1653180f3 | |
parent | a088f2dd152ec5f1131ab03ec3f081af0c7a1bbb (diff) | |
download | org.eclipse.tcf.agent-94ea1ab5da15528dab5f57f43dc350a01f46528b.tar.gz org.eclipse.tcf.agent-94ea1ab5da15528dab5f57f43dc350a01f46528b.tar.xz org.eclipse.tcf.agent-94ea1ab5da15528dab5f57f43dc350a01f46528b.zip |
Bug 529375 - Fix TCF Agent to build with musl C library
-rw-r--r-- | agent/Makefile.inc | 8 | ||||
-rwxr-xr-x | agent/bin/check-c-lib | 67 | ||||
-rw-r--r-- | agent/machine/arm/tcf/cpudefs-mdep.c | 8 | ||||
-rw-r--r-- | agent/machine/arm/tcf/regset-mdep.h | 6 | ||||
-rw-r--r-- | agent/machine/x86_64/tcf/cpudefs-mdep.c | 2 | ||||
-rw-r--r-- | agent/msvc/agent-vc2015.vcxproj | 1 | ||||
-rw-r--r-- | agent/msvc/agent-vc2015.vcxproj.filters | 3 | ||||
-rw-r--r-- | agent/system/Darwin/tcf/context-darwin.c | 2 | ||||
-rw-r--r-- | agent/system/FreeBSD/tcf/context-freebsd.c | 2 | ||||
-rw-r--r-- | agent/system/GNU/Linux/tcf/context-linux.c | 39 | ||||
-rw-r--r-- | agent/tcf/framework/mdep-ptrace.h | 65 | ||||
-rw-r--r-- | agent/tcf/framework/mdep.c | 10 | ||||
-rw-r--r-- | agent/tcf/framework/mdep.h | 42 | ||||
-rw-r--r-- | agent/tcf/main/test.c | 6 | ||||
-rw-r--r-- | agent/tcf/services/filesystem.c | 8 | ||||
-rw-r--r-- | agent/tcf/services/processes.c | 4 | ||||
-rw-r--r-- | agent/tcf/services/symbols_elf.c | 12 | ||||
-rw-r--r-- | agent/tcf/services/tcf_elf.c | 6 |
18 files changed, 201 insertions, 90 deletions
diff --git a/agent/Makefile.inc b/agent/Makefile.inc index 62a9d24f..e27982bb 100644 --- a/agent/Makefile.inc +++ b/agent/Makefile.inc @@ -2,6 +2,9 @@ CONF ?= Debug ifndef OPSYS OPSYS := $(shell uname -o 2>/dev/null || uname -s) + ifeq ($(OPSYS),Linux) + OPSYS := GNU/Linux + endif endif ifndef MACHINE MACHINE := $(shell uname -m) @@ -186,3 +189,8 @@ ifdef SERVICES endif OPTS += $(foreach dir,$(INCDIRS),-I$(TCF_AGENT_DIR)/$(dir)) + +ifeq ($(OPSYS),GNU/Linux) + CHECK_C_LIB := $(shell $(TCF_AGENT_DIR)/bin/check-c-lib $(CC) $(CFLAGS) $(OPTS)) + OPTS += $(CHECK_C_LIB) +endif diff --git a/agent/bin/check-c-lib b/agent/bin/check-c-lib new file mode 100755 index 00000000..6d436e11 --- /dev/null +++ b/agent/bin/check-c-lib @@ -0,0 +1,67 @@ +#!/bin/sh + +OPTS= +TEMP=obj/check-c-lib.c +mkdir -p obj || exit 1 + +CC="$*" +if [ "$CC" = "" ] ; then + CC=cc +fi +CC="$CC -o /dev/null $TEMP" + +cat >$TEMP << EOF +int main() { + return 0; +} +EOF +$CC 1>/dev/null 2>&1 +if [ "$?" != 0 ] ; then + # Not GCC ? + exit 0 +fi + +cat >$TEMP << EOF +#include <stdlib.h> +int main() { + return *canonicalize_file_name(""); +} +EOF +$CC 1>/dev/null 2>&1 +if [ "$?" = 0 ] ; then + OPTS="$OPTS -DUSE_canonicalize_file_name=1" +else + OPTS="$OPTS -DUSE_canonicalize_file_name=0" +fi + +cat >$TEMP << EOF +#include <sys/ptrace.h> +int main() { + enum __ptrace_request cmd = (enum __ptrace_request)0; + return cmd != 0; +} +EOF +$CC 1>/dev/null 2>&1 +if [ "$?" = 0 ] ; then + OPTS="$OPTS -DUSE_enum_ptrace_request=1" +else + OPTS="$OPTS -DUSE_enum_ptrace_request=0" +fi + +cat >$TEMP << EOF +#include <string.h> +int main() { + char buf[256]; + strlcpy(buf, "", sizeof(buf)); + strlcat(buf, "", sizeof(buf)); + return 0; +} +EOF +$CC 1>/dev/null 2>&1 +if [ "$?" = 0 ] ; then + OPTS="$OPTS -DUSE_strlcpy_strlcat=1" +else + OPTS="$OPTS -DUSE_strlcpy_strlcat=0" +fi + +echo $OPTS
\ No newline at end of file diff --git a/agent/machine/arm/tcf/cpudefs-mdep.c b/agent/machine/arm/tcf/cpudefs-mdep.c index 27ab0129..23cf90a6 100644 --- a/agent/machine/arm/tcf/cpudefs-mdep.c +++ b/agent/machine/arm/tcf/cpudefs-mdep.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013-2017 Stanislav Yakovlev and others. + * Copyright (c) 2013-2018 Stanislav Yakovlev and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. @@ -32,7 +32,7 @@ # include <sys/auxv.h> # include <asm/hwcap.h> #endif -#include <sys/ptrace.h> +#include <tcf/framework/mdep-ptrace.h> #include <tcf/framework/errors.h> #include <tcf/framework/cpudefs.h> #include <tcf/framework/context.h> @@ -89,10 +89,10 @@ static RegisterDefinition * lr_def = NULL; static RegisterDefinition * cpsr_def = NULL; #if !defined(PTRACE_GETHBPREGS) -#define PTRACE_GETHBPREGS (enum __ptrace_request)29 +# define PTRACE_GETHBPREGS 29 #endif #if !defined(PTRACE_SETHBPREGS) -#define PTRACE_SETHBPREGS (enum __ptrace_request)30 +# define PTRACE_SETHBPREGS 30 #endif #define ARM_DEBUG_ARCH_V6 1 diff --git a/agent/machine/arm/tcf/regset-mdep.h b/agent/machine/arm/tcf/regset-mdep.h index e5516042..c4014922 100644 --- a/agent/machine/arm/tcf/regset-mdep.h +++ b/agent/machine/arm/tcf/regset-mdep.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013-2017 Stanislav Yakovlev and others. + * Copyright (c) 2013-2018 Stanislav Yakovlev and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. @@ -28,11 +28,11 @@ #endif #ifndef PTRACE_GETREGSET -#define PTRACE_GETREGSET (enum __ptrace_request)0x4204 +# define PTRACE_GETREGSET 0x4204 #endif #ifndef PTRACE_SETREGSET -#define PTRACE_SETREGSET (enum __ptrace_request)0x4205 +# define PTRACE_SETREGSET 0x4205 #endif struct regset_gp { diff --git a/agent/machine/x86_64/tcf/cpudefs-mdep.c b/agent/machine/x86_64/tcf/cpudefs-mdep.c index 5047e694..8d8134c4 100644 --- a/agent/machine/x86_64/tcf/cpudefs-mdep.c +++ b/agent/machine/x86_64/tcf/cpudefs-mdep.c @@ -581,7 +581,7 @@ unsigned char BREAK_INST[] = { 0xcc }; #ifdef MDEP_OtherRegisters -#include <sys/ptrace.h> +#include <tcf/framework/mdep-ptrace.h> #if !defined(PTRACE_GETFPXREGS) && !defined(PT_GETFPXREGS) #define PTRACE_GETFPXREGS 18 diff --git a/agent/msvc/agent-vc2015.vcxproj b/agent/msvc/agent-vc2015.vcxproj index d771113f..9df87b46 100644 --- a/agent/msvc/agent-vc2015.vcxproj +++ b/agent/msvc/agent-vc2015.vcxproj @@ -367,6 +367,7 @@ <ClInclude Include="..\tcf\framework\cpudefs-mdep-mux.h" />
<ClInclude Include="..\tcf\framework\cpudefs-mux.h" />
<ClInclude Include="..\tcf\framework\mdep-fs.h" />
+ <ClInclude Include="..\tcf\framework\mdep-ptrace.h" />
<ClInclude Include="..\tcf\services\breakpoints-ext.h" />
<ClInclude Include="..\tcf\services\dwarfecomp-ext.h" />
<ClInclude Include="..\tcf\services\dwarfreloc-ext.h" />
diff --git a/agent/msvc/agent-vc2015.vcxproj.filters b/agent/msvc/agent-vc2015.vcxproj.filters index 53979338..8979890b 100644 --- a/agent/msvc/agent-vc2015.vcxproj.filters +++ b/agent/msvc/agent-vc2015.vcxproj.filters @@ -813,5 +813,8 @@ <ClInclude Include="..\machine\x86_64\tcf\cpu-regs-gdb.h">
<Filter>machine\x86_64</Filter>
</ClInclude>
+ <ClInclude Include="..\tcf\framework\mdep-ptrace.h">
+ <Filter>framework</Filter>
+ </ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/agent/system/Darwin/tcf/context-darwin.c b/agent/system/Darwin/tcf/context-darwin.c index 2b631d62..28f3932d 100644 --- a/agent/system/Darwin/tcf/context-darwin.c +++ b/agent/system/Darwin/tcf/context-darwin.c @@ -29,8 +29,8 @@ #include <signal.h> #include <sched.h> #include <sys/syscall.h> -#include <sys/ptrace.h> #include <mach/thread_status.h> +#include <tcf/framework/mdep-ptrace.h> #include <tcf/framework/context.h> #include <tcf/framework/events.h> #include <tcf/framework/errors.h> diff --git a/agent/system/FreeBSD/tcf/context-freebsd.c b/agent/system/FreeBSD/tcf/context-freebsd.c index cde911cf..817e25f0 100644 --- a/agent/system/FreeBSD/tcf/context-freebsd.c +++ b/agent/system/FreeBSD/tcf/context-freebsd.c @@ -28,7 +28,7 @@ #include <errno.h> #include <signal.h> #include <sched.h> -#include <sys/ptrace.h> +#include <tcf/framework/mdep-ptrace.h> #include <tcf/framework/context.h> #include <tcf/framework/events.h> #include <tcf/framework/errors.h> diff --git a/agent/system/GNU/Linux/tcf/context-linux.c b/agent/system/GNU/Linux/tcf/context-linux.c index d4eb5e6b..7a293d79 100644 --- a/agent/system/GNU/Linux/tcf/context-linux.c +++ b/agent/system/GNU/Linux/tcf/context-linux.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Wind River Systems, Inc. and others. + * Copyright (c) 2007-2018 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. @@ -32,9 +32,9 @@ #include <dirent.h> #include <ctype.h> #include <asm/unistd.h> -#include <sys/ptrace.h> #include <sys/utsname.h> #include <linux/kdev_t.h> +#include <tcf/framework/mdep-ptrace.h> #include <tcf/framework/mdep-fs.h> #include <tcf/framework/context.h> #include <tcf/framework/events.h> @@ -59,37 +59,8 @@ #include <tcf/framework/context-mux.h> #endif -#if !defined(PTRACE_SETOPTIONS) -#define PTRACE_SETOPTIONS (enum __ptrace_request)0x4200 -#define PTRACE_GETEVENTMSG (enum __ptrace_request)0x4201 -#define PTRACE_GETSIGINFO (enum __ptrace_request)0x4202 -#define PTRACE_SETSIGINFO (enum __ptrace_request)0x4203 - -#define PTRACE_O_TRACESYSGOOD 0x00000001 -#define PTRACE_O_TRACEFORK 0x00000002 -#define PTRACE_O_TRACEVFORK 0x00000004 -#define PTRACE_O_TRACECLONE 0x00000008 -#define PTRACE_O_TRACEEXEC 0x00000010 -#define PTRACE_O_TRACEVFORKDONE 0x00000020 -#define PTRACE_O_TRACEEXIT 0x00000040 - -#define PTRACE_EVENT_FORK 1 -#define PTRACE_EVENT_VFORK 2 -#define PTRACE_EVENT_CLONE 3 -#define PTRACE_EVENT_EXEC 4 -#define PTRACE_EVENT_VFORK_DONE 5 -#define PTRACE_EVENT_EXIT 6 -#endif - #define USE_PTRACE_SYSCALL 0 -#if defined(__arm__) || defined(__aarch64__) -#if !defined(PTRACE_GETVFPREGS) -#define PTRACE_GETVFPREGS (enum __ptrace_request)27 -#define PTRACE_SETVFPREGS (enum __ptrace_request)28 -#endif -#endif - static const int PTRACE_FLAGS = #if USE_PTRACE_SYSCALL PTRACE_O_TRACESYSGOOD | @@ -483,7 +454,7 @@ static const char * get_ptrace_cmd_name(int cmd) { static int do_single_step(Context * ctx) { uint32_t is_cont = 0; ContextExtensionLinux * ext = EXT(ctx); - enum __ptrace_request cmd = PTRACE_SINGLESTEP; + int cmd = PTRACE_SINGLESTEP; assert(!ext->pending_step); @@ -540,9 +511,9 @@ int context_continue(Context * ctx) { int signal = 0; ContextExtensionLinux * ext = EXT(ctx); #if USE_PTRACE_SYSCALL - enum __ptrace_request cmd = PTRACE_SYSCALL; + int cmd = PTRACE_SYSCALL; #else - enum __ptrace_request cmd = PTRACE_CONT; + int cmd = PTRACE_CONT; #endif assert(is_dispatch_thread()); diff --git a/agent/tcf/framework/mdep-ptrace.h b/agent/tcf/framework/mdep-ptrace.h new file mode 100644 index 00000000..e1fd2ebc --- /dev/null +++ b/agent/tcf/framework/mdep-ptrace.h @@ -0,0 +1,65 @@ +/******************************************************************************* +* Copyright (c) 2018 Xilinx, Inc. and others. +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* and Eclipse Distribution License v1.0 which accompany this distribution. +* The Eclipse Public License is available at +* http://www.eclipse.org/legal/epl-v10.html +* and the Eclipse Distribution License is available at +* http://www.eclipse.org/org/documents/edl-v10.php. +* You may elect to redistribute this code under either of these licenses. +* +* Contributors: +* Xilinx - initial API and implementation +*******************************************************************************/ + +/* + * Machine and OS dependent definitions for ptrace. + */ + +#ifndef D_mdep_ptrace +#define D_mdep_ptrace + +#include <sys/ptrace.h> + +#ifndef USE_enum_ptrace_request +# if defined(__GLIBC__) +# define USE_enum_ptrace_request 1 +# else +# define USE_enum_ptrace_request 0 +# endif +#endif +#if USE_enum_ptrace_request +# define ptrace(req, pid, addr, data) (ptrace)((enum __ptrace_request)(req), pid, addr, data) +#endif + +#if !defined(PTRACE_SETOPTIONS) +# define PTRACE_SETOPTIONS 0x4200 +# define PTRACE_GETEVENTMSG 0x4201 +# define PTRACE_GETSIGINFO 0x4202 +# define PTRACE_SETSIGINFO 0x4203 + +# define PTRACE_O_TRACESYSGOOD 0x00000001 +# define PTRACE_O_TRACEFORK 0x00000002 +# define PTRACE_O_TRACEVFORK 0x00000004 +# define PTRACE_O_TRACECLONE 0x00000008 +# define PTRACE_O_TRACEEXEC 0x00000010 +# define PTRACE_O_TRACEVFORKDONE 0x00000020 +# define PTRACE_O_TRACEEXIT 0x00000040 + +# define PTRACE_EVENT_FORK 1 +# define PTRACE_EVENT_VFORK 2 +# define PTRACE_EVENT_CLONE 3 +# define PTRACE_EVENT_EXEC 4 +# define PTRACE_EVENT_VFORK_DONE 5 +# define PTRACE_EVENT_EXIT 6 +#endif + +#if defined(__arm__) || defined(__aarch64__) +# if !defined(PTRACE_GETVFPREGS) +# define PTRACE_GETVFPREGS 27 +# define PTRACE_SETVFPREGS 28 +# endif +#endif + +#endif /* D_mdep_ptrace */ diff --git a/agent/tcf/framework/mdep.c b/agent/tcf/framework/mdep.c index 8aee811f..372d95af 100644 --- a/agent/tcf/framework/mdep.c +++ b/agent/tcf/framework/mdep.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007-2017 Wind River Systems, Inc. and others. + * Copyright (c) 2007-2018 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. @@ -925,10 +925,8 @@ int clock_gettime(clockid_t clock_id, struct timespec * tp) { #endif #if defined(__UCLIBC__) || defined(ANDROID) -#include <fcntl.h> - int posix_openpt(int flags) { - return (open("/dev/ptmx", flags)); + return open("/dev/ptmx", flags); } #endif @@ -1097,7 +1095,7 @@ char * canonicalize_file_name(const char * path) { return strdup(res); } -#elif defined(__UCLIBC__) +#elif !USE_canonicalize_file_name char * canonicalize_file_name(const char * path) { return realpath(path, NULL); @@ -1817,7 +1815,7 @@ const char * double_to_str(double n) { return tmp_strdup(buf + i); } -#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(__VXWORKS__) +#if !USE_strlcpy_strlcat size_t strlcpy(char * dst, const char * src, size_t size) { char ch; diff --git a/agent/tcf/framework/mdep.h b/agent/tcf/framework/mdep.h index f90f03f2..f30ed023 100644 --- a/agent/tcf/framework/mdep.h +++ b/agent/tcf/framework/mdep.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007-2017 Wind River Systems, Inc. and others. + * Copyright (c) 2007-2018 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. @@ -176,10 +176,6 @@ extern ssize_t pwrite(int fd, const void * buf, size_t size, off_t offset); #endif /* __CYGWIN__ */ -extern char * canonicalize_file_name(const char * path); - -#define O_LARGEFILE 0 - #elif defined(_WRS_KERNEL) /* VxWork kernel module */ @@ -214,11 +210,9 @@ typedef unsigned long useconds_t; #endif #define O_BINARY 0 -#define O_LARGEFILE 0 #define lstat stat extern int truncate(char * path, int64_t size); -extern char * canonicalize_file_name(const char * path); extern ssize_t pread(int fd, void * buf, size_t size, off_t offset); extern ssize_t pwrite(int fd, const void * buf, size_t size, off_t offset); @@ -293,10 +287,8 @@ extern int loc_clock_gettime(int, struct timespec *); #define O_BINARY 0 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(__sun__) -# define O_LARGEFILE 0 extern char ** environ; -extern char * canonicalize_file_name(const char * path); -#endif /* BSD */ +#endif #if defined(__APPLE__) && !defined(CLOCK_REALTIME) # define CLOCK_REALTIME 1 @@ -350,14 +342,34 @@ extern double str_to_double(const char * buf, char ** end); /* Convert double to string according to C/C++/JSON syntax */ extern const char * double_to_str(double n); -#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(__VXWORKS__) && !defined(ANDROID) -extern size_t strlcpy(char * dst, const char * src, size_t size); -extern size_t strlcat(char * dst, const char * src, size_t size); +#if defined(__UCLIBC__) || defined(ANDROID) +extern int posix_openpt(int flags); #endif -#if defined(__UCLIBC__) || defined(ANDROID) +#ifndef USE_canonicalize_file_name +# if defined(_WIN32) || defined(__CYGWIN__) || \ + defined(_WRS_KERNEL) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || \ + defined(__sun__) || defined(ANDROID) || defined(__UCLIBC__) || \ + !defined(__GLIBC__) || (defined(__GLIBC__) && !defined(__USE_GNU)) +# define USE_canonicalize_file_name 0 +# else +# define USE_canonicalize_file_name 1 +# endif +#endif +#if !USE_canonicalize_file_name extern char * canonicalize_file_name(const char * path); -extern int posix_openpt(int flags); +#endif + +#ifndef USE_strlcpy_strlcat +# if defined(_WIN32) || defined(__CYGWIN__) || defined(__sun__) || defined(__GLIBC__) +# define USE_strlcpy_strlcat 0 +# else +# define USE_strlcpy_strlcat 1 +# endif +#endif +#if !USE_strlcpy_strlcat +extern size_t strlcpy(char * dst, const char * src, size_t size); +extern size_t strlcat(char * dst, const char * src, size_t size); #endif #if defined(__i386__) || defined(__x86_64__) diff --git a/agent/tcf/main/test.c b/agent/tcf/main/test.c index 384c967f..4a29bbc6 100644 --- a/agent/tcf/main/test.c +++ b/agent/tcf/main/test.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2014 Wind River Systems, Inc. and others. + * Copyright (c) 2007-2018 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. @@ -17,10 +17,6 @@ * Agent self-testing service. */ -#if defined(__GNUC__) && !defined(_GNU_SOURCE) -# define _GNU_SOURCE -#endif - #include <tcf/config.h> #if ENABLE_RCBP_TEST diff --git a/agent/tcf/services/filesystem.c b/agent/tcf/services/filesystem.c index 3993e1b9..7abd130e 100644 --- a/agent/tcf/services/filesystem.c +++ b/agent/tcf/services/filesystem.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007-2017 Wind River Systems, Inc. and others. + * Copyright (c) 2007-2018 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. @@ -17,10 +17,6 @@ * Target service implementation: file system access (TCF name FileSystem) */ -#if defined(__GNUC__) && !defined(_GNU_SOURCE) -# define _GNU_SOURCE -#endif - #include <tcf/config.h> #if SERVICE_FileSystem @@ -611,7 +607,7 @@ static void write_file_attrs(OutputStream * out, FileAttrs * attrs) { } static int to_local_open_flags(int flags) { - int res = O_BINARY | O_LARGEFILE; + int res = O_BINARY; if ((flags & TCF_O_READ) && (flags & TCF_O_WRITE)) res |= O_RDWR; else if (flags & TCF_O_READ) res |= O_RDONLY; else if (flags & TCF_O_WRITE) res |= O_WRONLY; diff --git a/agent/tcf/services/processes.c b/agent/tcf/services/processes.c index af127985..f6b6b00a 100644 --- a/agent/tcf/services/processes.c +++ b/agent/tcf/services/processes.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007-2017 Wind River Systems, Inc. and others. + * Copyright (c) 2007-2018 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. @@ -1432,7 +1432,7 @@ static int start_process_imp(Channel * c, char ** envp, const char * dir, const /* http://docs.oracle.com/cd/E18752_01/html/816-4855/termsub15-44781.html */ fd_tty_master = open("/dev/ptmx", O_RDWR); #else - fd_tty_master = posix_openpt(O_RDWR|O_NOCTTY); + fd_tty_master = posix_openpt(O_RDWR | O_NOCTTY); #endif if (fd_tty_master < 0 || grantpt(fd_tty_master) < 0 || unlockpt(fd_tty_master) < 0) err = errno; if (!err && (tty_slave_name = ptsname(fd_tty_master)) == NULL) err = EINVAL; diff --git a/agent/tcf/services/symbols_elf.c b/agent/tcf/services/symbols_elf.c index b38e5d5c..5af3cff7 100644 --- a/agent/tcf/services/symbols_elf.c +++ b/agent/tcf/services/symbols_elf.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Wind River Systems, Inc. and others. + * Copyright (c) 2007-2018 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. @@ -17,10 +17,6 @@ * Symbols service - ELF version. */ -#if defined(__GNUC__) && !defined(_GNU_SOURCE) -# define _GNU_SOURCE -#endif - #include <tcf/config.h> #if SERVICE_Symbols && (!ENABLE_SymbolsProxy || ENABLE_SymbolsMux) && ENABLE_ELF @@ -4298,8 +4294,10 @@ int get_symbol_flags(const Symbol * sym, SYM_FLAGS * flags) { } int get_symbol_props(const Symbol * sym, SymbolProperties * props) { -#define STO_PPC64_LOCAL_BIT 5 -#define STO_PPC64_LOCAL_MASK (7 << STO_PPC64_LOCAL_BIT) +#ifndef STO_PPC64_LOCAL_MASK +# define STO_PPC64_LOCAL_BIT 5 +# define STO_PPC64_LOCAL_MASK (7 << STO_PPC64_LOCAL_BIT) +#endif #define IS_PPC64_V2(elfsym) ((elfsym->file->machine == EM_PPC64) && (elfsym->file->flags & 0x3) == 2) ELF_SymbolInfo elf_sym_info; diff --git a/agent/tcf/services/tcf_elf.c b/agent/tcf/services/tcf_elf.c index cd82bcbd..efcab825 100644 --- a/agent/tcf/services/tcf_elf.c +++ b/agent/tcf/services/tcf_elf.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Wind River Systems, Inc. and others. + * Copyright (c) 2007-2018 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. @@ -17,10 +17,6 @@ * This module implements reading and caching of ELF files. */ -#if defined(__GNUC__) && !defined(_GNU_SOURCE) -# define _GNU_SOURCE -#endif - #include <tcf/config.h> #if ENABLE_ELF |