public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gprofng: 30889 can't compile without large file support
@ 2024-01-11  4:02 vladimir.mezentsev
  2024-01-11  5:53 ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: vladimir.mezentsev @ 2024-01-11  4:02 UTC (permalink / raw)
  To: binutils; +Cc: Vladimir Mezentsev

From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>

gprofng/ChangeLog
2024-01-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR 30889
	* src/DbeJarFile.cc (O_LARGEFILE): Define to 0, if not defined.
	* src/Module.cc (O_LARGEFILE): Likewise.
	* src/gp-display-src.cc (O_LARGEFILE): Likewise.
---
 gprofng/src/DbeJarFile.cc     | 4 ++++
 gprofng/src/Module.cc         | 4 ++++
 gprofng/src/gp-display-src.cc | 4 ++++
 3 files changed, 12 insertions(+)

diff --git a/gprofng/src/DbeJarFile.cc b/gprofng/src/DbeJarFile.cc
index fe3427f0b54..d14fd3bb0a6 100644
--- a/gprofng/src/DbeJarFile.cc
+++ b/gprofng/src/DbeJarFile.cc
@@ -30,6 +30,10 @@
 #include "Data_window.h"
 #include "vec.h"
 
+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+
 static uint32_t
 get_u1 (unsigned char *b)
 {
diff --git a/gprofng/src/Module.cc b/gprofng/src/Module.cc
index d5255dcd05f..f59dea1b595 100644
--- a/gprofng/src/Module.cc
+++ b/gprofng/src/Module.cc
@@ -41,6 +41,10 @@
 #include "PathTree.h"
 #include "Elf.h"
 
+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+
 Module::Module ()
 {
   lang_code = Sp_lang_unknown;
diff --git a/gprofng/src/gp-display-src.cc b/gprofng/src/gp-display-src.cc
index 200e6080d2e..78560d49e52 100644
--- a/gprofng/src/gp-display-src.cc
+++ b/gprofng/src/gp-display-src.cc
@@ -33,6 +33,10 @@
 #include "DbeFile.h"
 #include "Command.h"
 
+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+
 class er_src : public DbeApplication
 {
 public:
-- 
2.31.1


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

* Re: [PATCH] gprofng: 30889 can't compile without large file support
  2024-01-11  4:02 [PATCH] gprofng: 30889 can't compile without large file support vladimir.mezentsev
@ 2024-01-11  5:53 ` Mike Frysinger
  2024-01-11  8:09   ` Vladimir Mezentsev
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2024-01-11  5:53 UTC (permalink / raw)
  To: vladimir.mezentsev; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

On 10 Jan 2024 20:02, vladimir.mezentsev@oracle.com wrote:
> gprofng/ChangeLog
> 2024-01-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
> 
> 	PR 30889
> 	* src/DbeJarFile.cc (O_LARGEFILE): Define to 0, if not defined.
> 	* src/Module.cc (O_LARGEFILE): Likewise.
> 	* src/gp-display-src.cc (O_LARGEFILE): Likewise.

can't you put this in a single header file (gprof.h?) instead of duplicating
the boilerplate in a bunch of files ?
-mike

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] gprofng: 30889 can't compile without large file support
  2024-01-11  5:53 ` Mike Frysinger
@ 2024-01-11  8:09   ` Vladimir Mezentsev
  0 siblings, 0 replies; 6+ messages in thread
From: Vladimir Mezentsev @ 2024-01-11  8:09 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: binutils



On 1/10/24 21:53, Mike Frysinger wrote:
> On 10 Jan 2024 20:02, vladimir.mezentsev@oracle.com wrote:
>> gprofng/ChangeLog
>> 2024-01-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
>>
>> 	PR 30889
>> 	* src/DbeJarFile.cc (O_LARGEFILE): Define to 0, if not defined.
>> 	* src/Module.cc (O_LARGEFILE): Likewise.
>> 	* src/gp-display-src.cc (O_LARGEFILE): Likewise.
> can't you put this in a single header file (gprof.h?) instead of duplicating
> the boilerplate in a bunch of files ?
Mike,  thank you for suggestion.
I will try this tomorrow.
Maybe this can be done in gprofng/configure.ac and 
gprofng/common/config.h.in

-Vladimir
> -mike


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

* Re: [PATCH] gprofng: 30889 can't compile without large file support
  2024-01-12  9:20 ` Andreas Schwab
@ 2024-01-12 19:49   ` Vladimir Mezentsev
  0 siblings, 0 replies; 6+ messages in thread
From: Vladimir Mezentsev @ 2024-01-12 19:49 UTC (permalink / raw)
  To: binutils

On 1/10/24 21:53, Mike Frysinger wrote:
> can't you put this in a single header file (gprof.h?) instead of 
> duplicating
> the boilerplate in a bunch of files ?
> -mike


On 1/12/24 01:20, Andreas Schwab wrote:
> If you are using open64 you don't need O_LARGEFILE at all.  An autoconf
> check is overkill anyway, you can just use #ifdef.

Agree with both comments.

Please review the new fix below.


gprofng/src/util.h is included in all files where we use O_LARGEFILE,
and is always included after <fcntl.h> where O_LARGEFILE may be defined.


gprofng/ChangeLog
2024-01-12  Vladimir Mezentsev <vladimir.mezentsev@oracle.com>

     PR 30889
     * src/util.h (O_LARGEFILE): Define to 0, if not defined.
---
  gprofng/src/util.h | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/gprofng/src/util.h b/gprofng/src/util.h
index c6382aab5bb..cbbc2f7e118 100644
--- a/gprofng/src/util.h
+++ b/gprofng/src/util.h
@@ -32,6 +32,10 @@
  #include "i18n.h"
  #include "debug.h"

+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+
  #define SWAP_ENDIAN(x)  swapByteOrder((void *) (&(x)), sizeof(x))
  #define AppendString(len, arr, ...) len += snprintf(arr + len, 
sizeof(arr) - len, __VA_ARGS__)
  #define ARR_SIZE(x)     (sizeof (x) / sizeof (*(x)))
-- 
2.31.1


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

* Re: [PATCH] gprofng: 30889 can't compile without large file support
  2024-01-12  4:10 vladimir.mezentsev
@ 2024-01-12  9:20 ` Andreas Schwab
  2024-01-12 19:49   ` Vladimir Mezentsev
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2024-01-12  9:20 UTC (permalink / raw)
  To: vladimir.mezentsev; +Cc: binutils

If you are using open64 you don't need O_LARGEFILE at all.  An autoconf
check is overkill anyway, you can just use #ifdef.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

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

* [PATCH] gprofng: 30889 can't compile without large file support
@ 2024-01-12  4:10 vladimir.mezentsev
  2024-01-12  9:20 ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: vladimir.mezentsev @ 2024-01-12  4:10 UTC (permalink / raw)
  To: binutils; +Cc: Vladimir Mezentsev

From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>

gprofng/ChangeLog
2024-01-11  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR 30889
	* configure.ac (O_LARGEFILE): Define to 0, if not defined.
	* configure: Rebuild.
	* common/config.h.in: Rebuild.
---
 gprofng/common/config.h.in |  3 +++
 gprofng/configure          | 26 ++++++++++++++++++++++++++
 gprofng/configure.ac       | 11 +++++++++++
 3 files changed, 40 insertions(+)

diff --git a/gprofng/common/config.h.in b/gprofng/common/config.h.in
index f8484f238fd..1e719b605dd 100644
--- a/gprofng/common/config.h.in
+++ b/gprofng/common/config.h.in
@@ -56,6 +56,9 @@
    */
 #undef LT_OBJDIR
 
+/* Define if O_LARGEFILE is not in fcntl.h */
+#undef O_LARGEFILE
+
 /* Name of package */
 #undef PACKAGE
 
diff --git a/gprofng/configure b/gprofng/configure
index 1c6a99291be..48161190485 100755
--- a/gprofng/configure
+++ b/gprofng/configure
@@ -16648,6 +16648,32 @@ $as_echo "#define DEBUG 1" >>confdefs.h
 
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for O_LARGEFILE in fcntl.h" >&5
+$as_echo_n "checking for O_LARGEFILE in fcntl.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <fcntl.h>
+#ifndef O_LARGEFILE
+MACRO_UNDEFINED
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "MACRO_UNDEFINED" >/dev/null 2>&1; then :
+
+
+$as_echo "#define O_LARGEFILE 0" >>confdefs.h
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: O_LARGEFILE is undefined" >&5
+$as_echo "O_LARGEFILE is undefined" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: O_LARGEFILE is defined" >&5
+$as_echo "O_LARGEFILE is defined" >&6; }
+fi
+rm -f conftest*
+
+
 cat > "dummy.c" << EOF
 #include <features.h>
 #if defined(__UCLIBC__)
diff --git a/gprofng/configure.ac b/gprofng/configure.ac
index a7221d9eaf0..150deac5fa2 100644
--- a/gprofng/configure.ac
+++ b/gprofng/configure.ac
@@ -151,6 +151,17 @@ if test "${enable_gprofng_debug}" = yes; then
     AC_DEFINE(DEBUG, 1, [Enable debugging output.])
 fi
 
+AC_MSG_CHECKING(for O_LARGEFILE in fcntl.h)
+AC_EGREP_CPP([MACRO_UNDEFINED], [
+#include <fcntl.h>
+#ifndef O_LARGEFILE
+MACRO_UNDEFINED
+#endif
+  ],[
+    AC_DEFINE(O_LARGEFILE, 0, [Define if O_LARGEFILE is not in fcntl.h])
+    AC_MSG_RESULT(O_LARGEFILE is undefined) ],
+  AC_MSG_RESULT(O_LARGEFILE is defined))
+
 cat > "dummy.c" << EOF
 #include <features.h>
 #if defined(__UCLIBC__)
-- 
2.31.1


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

end of thread, other threads:[~2024-01-12 19:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-11  4:02 [PATCH] gprofng: 30889 can't compile without large file support vladimir.mezentsev
2024-01-11  5:53 ` Mike Frysinger
2024-01-11  8:09   ` Vladimir Mezentsev
2024-01-12  4:10 vladimir.mezentsev
2024-01-12  9:20 ` Andreas Schwab
2024-01-12 19:49   ` Vladimir Mezentsev

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).