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.herm...@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.herm...@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.herm...@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