From: Ulf Hermann <ulf.hermann@qt.io>
To: <elfutils-devel@sourceware.org>
Subject: [PATCH] Drop the trickery in printversion.h
Date: Thu, 04 May 2017 15:05:00 -0000 [thread overview]
Message-ID: <4e046e09-52cb-0bf4-a7ae-95c9426fca25@qt.io> (raw)
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
reply other threads:[~2017-05-04 14:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4e046e09-52cb-0bf4-a7ae-95c9426fca25@qt.io \
--to=ulf.hermann@qt.io \
--cc=elfutils-devel@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).