* [PATCH] Drop the trickery in printversion.h
@ 2017-05-04 15:05 Ulf Hermann
0 siblings, 0 replies; only message in thread
From: Ulf Hermann @ 2017-05-04 15:05 UTC (permalink / raw)
To: elfutils-devel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-05-04 14:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-04 15:05 [PATCH] Drop the trickery in printversion.h Ulf Hermann
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).