Skip to content

Commit

Permalink
Improve compiler data section support checks.
Browse files Browse the repository at this point in the history
Add --disable-variable-clustering option to configuration to manually disable
any data section specifiers.
Fix compiler warning for a printf on 64bit OS X.
  • Loading branch information
valient committed Nov 28, 2009
1 parent 082ca85 commit 040240d
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 34 deletions.
44 changes: 35 additions & 9 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,19 +1,45 @@

Fri Jun 6 14:44:13 PDT 2008 Valient Gough <[email protected]>
Sat Nov 28 2009 Valient Gough <[email protected]>
* fix printf arg warning
* add configure argument to disable variable clustering
* check for two-argument section attribute support

Sun Nov 22 2009 Valient Gough <[email protected]>
* avoid doc build failure if not building docs

Tue Aug 18 2009 Valient Gough <[email protected]>
* single char path length test

Thu Nov 6 2008 Valient Gough <[email protected]>
* fix off-by-one which cause single-char paths to be ignored

Fri Jun 27 2008 Valient Gough <[email protected]>
* simplify macros in rlog-c99
* add test for gcc section attribute to configure

Sat Jun 14 2008 Valient Gough <[email protected]>
* add warning if timer isn't accurate enough to get good benchmark
results
* no longer use RDTSC function unless specifically requested during
configuration
* update configure using autoupdate
* bump version to 1.4
* add global lock to RLog_Register function, to avoid race in threaded
apps

Sat Jun 7 2008 Valient Gough <[email protected]>
* add missing RLOG_SECTION definition

Fri Jun 6 2008 Valient Gough <[email protected]>
* update changelog
* bump version to 1.3.8, lib version to 5

Fri Jun 6 14:33:37 PDT 2008 Valient Gough <[email protected]>
* import Windows VC80 patch from David Wolfe

Fri Jun 6 14:31:01 PDT 2008 Valient Gough <[email protected]>
* minor fixes for Windows compile

Fri Jun 6 14:16:04 PDT 2008 Valient Gough <[email protected]>
* use inline functions for modifying PublishLoc

Fri Jun 6 14:14:17 PDT 2008 Valient Gough <[email protected]>
* add PublishLoc destructor. Struct initialization check hidden in
out-of-band code.
* move enable flag to separate data segment for better cache locality
* minor code cleanup for enabled flag

Fri Jun 6 13:45:00 PDT 2008 Valient Gough <[email protected]>
* move enable flag to separate data segment for better cache locality
Expand Down
62 changes: 39 additions & 23 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -100,30 +100,46 @@ fi
AC_SUBST(HAVE_PRINTF_FP_PROTOTYPE)


# check if we can use printf attribute on a function..
AC_MSG_CHECKING(if section attribute works)
AC_COMPILE_IFELSE( [[
extern void test(int val);
int main()
{
static int foo __attribute__ (( section("RLOG_DATA") )) = 0;
test( foo );
return 0;
}
]],
with_section_attr="yes",
with_section_attr="no")
AC_MSG_RESULT($with_section_attr)
if test "x$with_section_attr" = "xyes"; then
HAVE_GCC_SECTION_ATTRIBUTE="1"
else
HAVE_GCC_SECTION_ATTRIBUTE="0"
AC_ARG_ENABLE(variable-clustering,
AS_HELP_STRING([--disable-variable-clustering],
[disables rlog variable clustering via separate data section]),
with_var_cluster=$enableval,with_var_cluster="test")


HAVE_GCC_DATA_SECTION_ATTRIBUTE="0"
HAVE_GCC_SIMPLE_SECTION_ATTRIBUTE="0"
if test "x$with_var_cluster" = "xtest"; then
# check if we can specify data section for variables
AC_MSG_CHECKING(if section attribute works)
with_section_attr="no"
AC_COMPILE_IFELSE( [[
extern void test(int val);
int main()
{
static int foo __attribute__ (( section("__DATA, RLOG_DATA") )) = 0;
test( foo );
return 0;
}
]],
[[HAVE_GCC_DATA_SECTION_ATTRIBUTE="1"
with_section_attr="yes"]])
AC_COMPILE_IFELSE( [[
extern void test(int val);
int main()
{
static int foo __attribute__ (( section("RLOG_DATA") )) = 0;
test( foo );
return 0;
}
]],
[[HAVE_GCC_SIMPLE_SECTION_ATTRIBUTE="1"
with_section_attr="yes"]])
AC_MSG_RESULT($with_section_attr)
fi
AC_SUBST(HAVE_GCC_SECTION_ATTRIBUTE)

AC_SUBST(HAVE_GCC_DATA_SECTION_ATTRIBUTE)
AC_SUBST(HAVE_GCC_SIMPLE_SECTION_ATTRIBUTE)

AC_ARG_ENABLE(vararg,
AS_HELP_STRING([--disable-vararg],
Expand Down
2 changes: 1 addition & 1 deletion rlog/StdioNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ StdioNode::publish( const RLogData &data )
#ifndef _WIN32
if (outputThreadId) {
char tid[16] = "";
snprintf(tid,15,"%lu",pthread_self());
snprintf(tid,15,"%p",pthread_self());
ss << "[tid:" << tid << "] ";
}
#endif
Expand Down
4 changes: 3 additions & 1 deletion rlog/common.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
# define PRINTF(FMT,X) __attribute__ (( __format__ ( __printf__, FMT, X)))
# define HAVE_PRINTF_ATTR 1

#if @HAVE_GCC_SECTION_ATTRIBUTE@
#if @HAVE_GCC_DATA_SECTION_ATTRIBUTE@
# define RLOG_SECTION __attribute__ (( section("__DATA, RLOG_DATA") ))
#elif @HAVE_GCC_SIMPLE_SECTION_ATTRIBUTE@
# define RLOG_SECTION __attribute__ (( section("RLOG_DATA") ))
#else
# define RLOG_SECTION
Expand Down

0 comments on commit 040240d

Please sign in to comment.