bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-readline] [PATCH] Enable visibility annotations


From: Yury Gribov
Subject: Re: [Bug-readline] [PATCH] Enable visibility annotations
Date: Thu, 14 Apr 2016 16:43:08 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

On 04/14/2016 04:14 PM, Yury Gribov wrote:
On 04/14/2016 04:10 PM, Mike Frysinger wrote:
On 14 Apr 2016 15:28, Yury Gribov wrote:
On 04/14/2016 01:47 PM, Pedro Alves wrote:
On 04/14/2016 07:45 AM, Yury Gribov wrote:
These two patches add visibility annotations to readline's public
functions and also enable -fvisibility=hidden on platforms where it's
available.

This results in 9% size decrease (279K -> 254K) and 45% export symbols
reduction (655 -> 398) for libreadline on x86_64.

The autoconf hunk is similar to one that I've recently submitted to
X.org's libICE, hope there's no licensing problem about this.

Is this ok for trunk?

FYI, this is probably doing to break (at least) gdb against system
readline.  gdb relies on accessing a few private readline
symbols...  :-/

E.g.:

tui/tui-io.c:437:  extern int _rl_echoing_p;
completer.c:1677:  extern int _rl_complete_mark_directories;
completer.c:1770:extern int _rl_completion_prefix_display_length;
completer.c:1771:extern int _rl_print_completions_horizontally;

Unless/until someone fixes these and adds the missing public APIs
to readline, I think distros will need to either back off this
patch, or build gdb against a static readline, which they'd rather
not (at least Fedora doesn't want that).

We may need a configure option as workaround, or perhaps export
the _rl_foo symbols as well...

Thanks, this sounds as a general problem with visibility enabling.  Is
there some (relatively straightforward) way to find all used symbols?
I'm afraid there'll be more than just _rl_*...

just build gdb w/system readline enabled and see if it works :)

GDB - yes, sure but I'm more worried about other packages that silently
use non-public readline symbols...

Attached one more patch which visualizes symbols required by GDB trunk. I'd rather not mark all of rlprivate.h because this would probably defeat the purpose of the patch.

-Y

>From 78a2fab87b6c9c85830889a56222ef7dff19c5c8 Mon Sep 17 00:00:00 2001
From: Yury Gribov <address@hidden>
Date: Thu, 14 Apr 2016 16:41:06 +0300
Subject: [PATCH] Also visualize hidden functions that are used by gdb.

---
 rlprivate.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/rlprivate.h b/rlprivate.h
index 14a370d..ba5d3eb 100644
--- a/rlprivate.h
+++ b/rlprivate.h
@@ -273,7 +273,7 @@ extern void _rl_clear_screen PARAMS((void));
 extern void _rl_update_final PARAMS((void));
 extern void _rl_redisplay_after_sigwinch PARAMS((void));
 extern void _rl_clean_up_for_exit PARAMS((void));
-extern void _rl_erase_entire_line PARAMS((void));
+READLINE_EXPORT void _rl_erase_entire_line PARAMS((void));
 extern int _rl_current_display_line PARAMS((void));
 
 /* input.c */
@@ -396,7 +396,7 @@ extern int _rl_tropen PARAMS((void));
 extern int _rl_abort_internal PARAMS((void));
 extern int _rl_null_function PARAMS((int, int));
 extern char *_rl_strindex PARAMS((const char *, const char *));
-extern int _rl_qsort_string_compare PARAMS((char **, char **));
+READLINE_EXPORT int _rl_qsort_string_compare PARAMS((char **, char **));
 extern int (_rl_uppercase_p) PARAMS((int));
 extern int (_rl_lowercase_p) PARAMS((int));
 extern int (_rl_pure_alphabetic) PARAMS((int));
@@ -428,11 +428,11 @@ extern _rl_callback_generic_arg *_rl_callback_data;
 /* complete.c */
 extern int _rl_complete_show_all;
 extern int _rl_complete_show_unmodified;
-extern int _rl_complete_mark_directories;
-extern int _rl_complete_mark_symlink_dirs;
-extern int _rl_completion_prefix_display_length;
+READLINE_EXPORT int _rl_complete_mark_directories;
+READLINE_EXPORT int _rl_complete_mark_symlink_dirs;
+READLINE_EXPORT int _rl_completion_prefix_display_length;
 extern int _rl_completion_columns;
-extern int _rl_print_completions_horizontally;
+READLINE_EXPORT int _rl_print_completions_horizontally;
 extern int _rl_completion_case_fold;
 extern int _rl_completion_case_map;
 extern int _rl_match_hidden_files;
@@ -464,7 +464,7 @@ extern _rl_arg_cxt _rl_argcxt;
 extern int _rl_utf8locale;
 
 /* readline.c */
-extern int _rl_echoing_p;
+READLINE_EXPORT int _rl_echoing_p;
 extern int _rl_horizontal_scroll_mode;
 extern int _rl_mark_modified_lines;
 extern int _rl_bell_preference;
-- 
1.9.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]