Commit 4969c0d8 by H.J. Lu Committed by H.J. Lu

linux.h (TARGET_HAS_F_SETLKW): Renamed to ...

2005-07-13  H.J. Lu  <hongjiu.lu@intel.com>

	* config/alpha/linux.h (TARGET_HAS_F_SETLKW): Renamed to ...
	(TARGET_POSIX_IO): This.
	* config/darwin.h: Likewise.
	* config/freebsd.h: Likewise.
	* config/linux.h: Likewise.
	* config/lynx.h: Likewise.
	* config/netbsd.h: Likewise.
	* config/rs6000/linux64.h: Likewise.
	* config/rs6000/linux.h: Likewise.
	* config/s390/tpf.h: Likewise.
	* config/sh/embed-elf.h: Likewise.
	* config/sparc/linux64.h: Likewise.
	* config/sparc/linux.h: Likewise.
	* config/svr4.h: Likewise.
	* gcov-io.h: Likewise.

	* doc/tm.texi: Updated.

	* libgcov.c (create_file_directory): Defined only if
	TARGET_POSIX_IO is defined.
	(gcov_exit): Call create_file_directory only if TARGET_POSIX_IO
	is defined.

From-SVN: r101973
parent 98b6d477
2005-07-13 H.J. Lu <hongjiu.lu@intel.com>
* config/alpha/linux.h (TARGET_HAS_F_SETLKW): Renamed to ...
(TARGET_POSIX_IO): This.
* config/darwin.h: Likewise.
* config/freebsd.h: Likewise.
* config/linux.h: Likewise.
* config/lynx.h: Likewise.
* config/netbsd.h: Likewise.
* config/rs6000/linux64.h: Likewise.
* config/rs6000/linux.h: Likewise.
* config/s390/tpf.h: Likewise.
* config/sh/embed-elf.h: Likewise.
* config/sparc/linux64.h: Likewise.
* config/sparc/linux.h: Likewise.
* config/svr4.h: Likewise.
* gcov-io.h: Likewise.
* doc/tm.texi: Updated.
* libgcov.c (create_file_directory): Defined only if
TARGET_POSIX_IO is defined.
(gcov_exit): Call create_file_directory only if TARGET_POSIX_IO
is defined.
2005-07-13 Jan Hubicka <jh@suse.cz> 2005-07-13 Jan Hubicka <jh@suse.cz>
* tree-ssa-operands.c (get_expr_operands): Fix typo in previous patch. * tree-ssa-operands.c (get_expr_operands): Fix typo in previous patch.
......
...@@ -71,7 +71,7 @@ Boston, MA 02110-1301, USA. */ ...@@ -71,7 +71,7 @@ Boston, MA 02110-1301, USA. */
runtime library. */ runtime library. */
#define TARGET_C99_FUNCTIONS 1 #define TARGET_C99_FUNCTIONS 1
#define TARGET_HAS_F_SETLKW #define TARGET_POSIX_IO
#define LINK_GCC_C_SEQUENCE_SPEC \ #define LINK_GCC_C_SEQUENCE_SPEC \
"%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
......
...@@ -1026,7 +1026,7 @@ void darwin_register_objc_includes (const char *, const char *, int); ...@@ -1026,7 +1026,7 @@ void darwin_register_objc_includes (const char *, const char *, int);
void add_framework_path (char *); void add_framework_path (char *);
#define TARGET_OPTF add_framework_path #define TARGET_OPTF add_framework_path
#define TARGET_HAS_F_SETLKW #define TARGET_POSIX_IO
/* All new versions of Darwin have C99 functions. */ /* All new versions of Darwin have C99 functions. */
#define TARGET_C99_FUNCTIONS 1 #define TARGET_C99_FUNCTIONS 1
......
...@@ -84,4 +84,4 @@ Boston, MA 02110-1301, USA. */ ...@@ -84,4 +84,4 @@ Boston, MA 02110-1301, USA. */
/* Used by libgcc2.c. We support file locking with fcntl / F_SETLKW. /* Used by libgcc2.c. We support file locking with fcntl / F_SETLKW.
This enables the test coverage code to use file locking when exiting a This enables the test coverage code to use file locking when exiting a
program, which avoids race conditions if the program has forked. */ program, which avoids race conditions if the program has forked. */
#define TARGET_HAS_F_SETLKW #define TARGET_POSIX_IO
...@@ -103,4 +103,4 @@ Boston, MA 02110-1301, USA. */ ...@@ -103,4 +103,4 @@ Boston, MA 02110-1301, USA. */
is present in the runtime library. */ is present in the runtime library. */
#define TARGET_C99_FUNCTIONS 1 #define TARGET_C99_FUNCTIONS 1
#define TARGET_HAS_F_SETLKW #define TARGET_POSIX_IO
...@@ -173,6 +173,6 @@ Boston, MA 02110-1301, USA. */ ...@@ -173,6 +173,6 @@ Boston, MA 02110-1301, USA. */
# define NO_IMPLICIT_EXTERN_C # define NO_IMPLICIT_EXTERN_C
#endif #endif
#ifndef TARGET_HAS_F_SETLKW #ifndef TARGET_POSIX_IO
# define TARGET_HAS_F_SETLKW # define TARGET_POSIX_IO
#endif #endif
...@@ -156,8 +156,8 @@ Boston, MA 02110-1301, USA. */ ...@@ -156,8 +156,8 @@ Boston, MA 02110-1301, USA. */
fprintf ((STREAM), "void __fini() {\n\t%s();\n}\n", (FUNC)); \ fprintf ((STREAM), "void __fini() {\n\t%s();\n}\n", (FUNC)); \
} while (0) } while (0)
#undef TARGET_HAS_F_SETLKW #undef TARGET_POSIX_IO
#define TARGET_HAS_F_SETLKW #define TARGET_POSIX_IO
/* Handle #pragma weak and #pragma pack. */ /* Handle #pragma weak and #pragma pack. */
......
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
#define TARGET_ASM_FILE_END file_end_indicate_exec_stack #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
#define TARGET_HAS_F_SETLKW #define TARGET_POSIX_IO
#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
......
...@@ -536,7 +536,7 @@ while (0) ...@@ -536,7 +536,7 @@ while (0)
#define TARGET_ASM_FILE_END rs6000_elf_end_indicate_exec_stack #define TARGET_ASM_FILE_END rs6000_elf_end_indicate_exec_stack
#define TARGET_HAS_F_SETLKW #define TARGET_POSIX_IO
#define LINK_GCC_C_SEQUENCE_SPEC \ #define LINK_GCC_C_SEQUENCE_SPEC \
"%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
......
...@@ -32,7 +32,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -32,7 +32,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#undef ASM_APP_OFF #undef ASM_APP_OFF
#define ASM_APP_OFF "#NO_APP\n" #define ASM_APP_OFF "#NO_APP\n"
#define NO_IMPLICIT_EXTERN_C #define NO_IMPLICIT_EXTERN_C
#define TARGET_HAS_F_SETLKW #define TARGET_POSIX_IO
#undef MD_EXEC_PREFIX #undef MD_EXEC_PREFIX
#undef MD_STARTFILE_PREFIX #undef MD_STARTFILE_PREFIX
......
...@@ -23,4 +23,4 @@ Boston, MA 02110-1301, USA. */ ...@@ -23,4 +23,4 @@ Boston, MA 02110-1301, USA. */
#undef USER_LABEL_PREFIX #undef USER_LABEL_PREFIX
#define USER_LABEL_PREFIX "_" #define USER_LABEL_PREFIX "_"
#undef TARGET_HAS_F_SETLKW #undef TARGET_POSIX_IO
...@@ -208,7 +208,7 @@ do { \ ...@@ -208,7 +208,7 @@ do { \
runtime library. */ runtime library. */
#define TARGET_C99_FUNCTIONS 1 #define TARGET_C99_FUNCTIONS 1
#define TARGET_HAS_F_SETLKW #define TARGET_POSIX_IO
#undef LINK_GCC_C_SEQUENCE_SPEC #undef LINK_GCC_C_SEQUENCE_SPEC
#define LINK_GCC_C_SEQUENCE_SPEC \ #define LINK_GCC_C_SEQUENCE_SPEC \
......
...@@ -342,7 +342,7 @@ do { \ ...@@ -342,7 +342,7 @@ do { \
runtime library. */ runtime library. */
#define TARGET_C99_FUNCTIONS 1 #define TARGET_C99_FUNCTIONS 1
#define TARGET_HAS_F_SETLKW #define TARGET_POSIX_IO
#undef LINK_GCC_C_SEQUENCE_SPEC #undef LINK_GCC_C_SEQUENCE_SPEC
#define LINK_GCC_C_SEQUENCE_SPEC \ #define LINK_GCC_C_SEQUENCE_SPEC \
......
...@@ -203,4 +203,4 @@ Boston, MA 02110-1301, USA. ...@@ -203,4 +203,4 @@ Boston, MA 02110-1301, USA.
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE BITS_PER_WORD #define WCHAR_TYPE_SIZE BITS_PER_WORD
#define TARGET_HAS_F_SETLKW #define TARGET_POSIX_IO
...@@ -9275,12 +9275,13 @@ You need only define this macro if the default of @samp{"LIBRARY_PATH"} ...@@ -9275,12 +9275,13 @@ You need only define this macro if the default of @samp{"LIBRARY_PATH"}
is wrong. is wrong.
@end defmac @end defmac
@defmac TARGET_HAS_F_SETLKW @defmac TARGET_POSIX_IO
Define this macro if the target supports file locking with fcntl / F_SETLKW@. Define this macro if the target supports the following POSIX@ file
Note that this functionality is part of POSIX@. functions, access, mkdir and file locking with fcntl / F_SETLKW@.
Defining @code{TARGET_HAS_F_SETLKW} will enable the test coverage code Defining @code{TARGET_POSIX_IO} will enable the test coverage code
to use file locking when exiting a program, which avoids race conditions to use file locking when exiting a program, which avoids race conditions
if the program has forked. if the program has forked. It will also create directories at run-time
for cross-profiling. @xref{Cross-profiling}.
@end defmac @end defmac
@defmac MAX_CONDITIONAL_EXECUTE @defmac MAX_CONDITIONAL_EXECUTE
......
...@@ -195,7 +195,7 @@ typedef signed gcov_type __attribute__ ((mode (QI))); ...@@ -195,7 +195,7 @@ typedef signed gcov_type __attribute__ ((mode (QI)));
#endif #endif
#if defined (TARGET_HAS_F_SETLKW) #if defined (TARGET_POSIX_IO)
#define GCOV_LOCKED 1 #define GCOV_LOCKED 1
#else #else
#define GCOV_LOCKED 0 #define GCOV_LOCKED 0
......
...@@ -91,6 +91,7 @@ static gcov_unsigned_t gcov_crc32; ...@@ -91,6 +91,7 @@ static gcov_unsigned_t gcov_crc32;
/* Size of the longest file name. */ /* Size of the longest file name. */
static size_t gcov_max_filename = 0; static size_t gcov_max_filename = 0;
#ifdef TARGET_POSIX_IO
/* Make sure path component of the given FILENAME exists, create /* Make sure path component of the given FILENAME exists, create
missing directories. FILENAME must be writable. missing directories. FILENAME must be writable.
Returns zero on success, or -1 if an error occurred. */ Returns zero on success, or -1 if an error occurred. */
...@@ -122,6 +123,7 @@ create_file_directory (char *filename) ...@@ -122,6 +123,7 @@ create_file_directory (char *filename)
}; };
return 0; return 0;
} }
#endif
/* Check if VERSION of the info block PTR matches libgcov one. /* Check if VERSION of the info block PTR matches libgcov one.
Return 1 on success, or zero in case of versions mismatch. Return 1 on success, or zero in case of versions mismatch.
...@@ -299,6 +301,7 @@ gcov_exit (void) ...@@ -299,6 +301,7 @@ gcov_exit (void)
if (!gcov_open (gi_filename)) if (!gcov_open (gi_filename))
{ {
#ifdef TARGET_POSIX_IO
/* Open failed likely due to missed directory. /* Open failed likely due to missed directory.
Create directory and retry to open file. */ Create directory and retry to open file. */
if (create_file_directory (gi_filename)) if (create_file_directory (gi_filename))
...@@ -306,6 +309,7 @@ gcov_exit (void) ...@@ -306,6 +309,7 @@ gcov_exit (void)
fprintf (stderr, "profiling:%s:Skip\n", gi_filename); fprintf (stderr, "profiling:%s:Skip\n", gi_filename);
continue; continue;
} }
#endif
if (!gcov_open (gi_filename)) if (!gcov_open (gi_filename))
{ {
fprintf (stderr, "profiling:%s:Cannot open\n", gi_filename); fprintf (stderr, "profiling:%s:Cannot open\n", gi_filename);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment