This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] Drop the trickery in printversion.h
- From: Ulf Hermann <ulf dot hermann at qt dot io>
- To: <elfutils-devel at sourceware dot org>
- Date: Thu, 4 May 2017 16:17:02 +0200
- Subject: [PATCH] Drop the trickery in printversion.h
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=qt.io;
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qtcompany.onmicrosoft.com; s=selector1-qt-io; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Upq47m19TyG6tRjOTU0JdPA80rNAPv4lIh86G9PKYB0=; b=YwOG3PeROtkMrAjEyH/7jwAFxzKUZAV/3G/slT09ShT90ZN1aKEGs0OClb0c6YbTOpW+Lm+rHdjo6h5QiN/z06q0hTUQYX4IfGl/uGj2tsygzJ/4fsR/6KI81zIx6ynErBtnZ1yIzZS2P6k1aC956uHFXwgZC+Hn1cqktlARl5o=
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
The mechanism of moving argp_program_version_hook and
argp_program_bug_address to .rodata is not portable and two pointers
per program are not worth the effort to make it portable. Revert the
pointers to be non-const.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
lib/ChangeLog | 5 +++++
lib/printversion.h | 10 +++-------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 59939bd..0433f02 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,5 +1,10 @@
2017-05-04 Ulf Hermann <ulf.hermann@qt.io>
+ * printversion.h: Define ARGP_PROGRAM_VERSION_HOOK_DEF and
+ ARGP_BUG_ADDRESS_DEF to be non-const and drop the asm tricks.
+
+2017-05-04 Ulf Hermann <ulf.hermann@qt.io>
+
* system.h: Define FILE_SYSTEM_PREFIX_LEN, ISDIRSEP, DIRSEP, PATHSEP,
and IS_ABSOLUTE_PATH to help with handling file system paths.
diff --git a/lib/printversion.h b/lib/printversion.h
index a9e059f..090b53a 100644
--- a/lib/printversion.h
+++ b/lib/printversion.h
@@ -36,14 +36,10 @@
void print_version (FILE *stream, struct argp_state *state);
/* We need define two variables, argp_program_version_hook and
- argp_program_bug_address, in all programs. argp.h declares these
- variables as non-const (which is correct in general). But we can
- do better, it is not going to change. So we want to move them into
- the .rodata section. Define macros to do the trick. */
+ argp_program_bug_address, in all programs. */
#define ARGP_PROGRAM_VERSION_HOOK_DEF \
- void (*const apvh) (FILE *, struct argp_state *) \
- __asm ("argp_program_version_hook")
+ void (*argp_program_version_hook) (FILE *, struct argp_state *)
#define ARGP_PROGRAM_BUG_ADDRESS_DEF \
- const char *const apba__ __asm ("argp_program_bug_address")
+ const char *argp_program_bug_address
#endif // PRINTVERSION_H
--
2.1.4