public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix glibc binary compatibility problems
@ 2002-06-07  3:06 Jakub Jelinek
  2002-06-21 22:14 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2002-06-07  3:06 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

Hi!

Current glibc has:
readelf -a /lib/i686/libc.so.6 | grep gethostent_r | less
  1062: 420f87e0   198 FUNC    GLOBAL DEFAULT   11 gethostent_r@GLIBC_2.0
  1380: 420f87e0   198 FUNC    LOCAL  DEFAULT   11 __old_gethostent_r
  1494: 420f8720   187 FUNC    LOCAL  HIDDEN   11 gethostent_r@@GLIBC_2.1.2
  2108: 420f8720   187 FUNC    LOCAL  HIDDEN   11 __gethostent_r
  3441: 420f87e0   198 FUNC    GLOBAL DEFAULT   11 gethostent_r@GLIBC_2.0
and similarly for all other get*ent_r functions, plus _IO_wfile_jumps
is not exported either but used to be (@@GLIBC_2.2).
in get*ent_r case the problem is:
extern int __getgrent_r (struct group *__resultbuf, char *buffer,
                         size_t __buflen, struct group **__result)
     __attribute__ ((visibility ("hidden")));
int
__getgrent_r (struct group *resbuf, char *buffer, size_t buflen,
                              struct group **result )
{
...
}
__asm__ (".symver " "__getgrent_r" "," "getgrent_r" "@@" "GLIBC_2.1.2");

gcc adds .hidden __getgrent_r at the point __getgrent_r is defined, which
is before the .symver and .symver copies the visibility attributes to the
getgrent_r@@GLIBC_2.1.2 symbol.
The following patch fixes this by using an extra alias in between (neither .set
nor = copies visibility attributes (of course alternatively the actual
function could be __new_getgrent_r and then have a .hidden alias
__getgrent_r)). Also, removes attribute_hidden from _IO_wfile_jumps which
should be exported (glibc uses INTUSE(_IO_wfile_jumps) everywhere anyway),
fixes a warning I introduced in my _IO_wfile_setbuf_mmap patch and also
I have noticed that _IO_WSETBUF for normal files uses _IO_new_file_setbuf
handler and that _IO_wfile_setbuf is completely unused. It seems strange
that setvbuf etc. functions call _IO_new_file_setbuf twice for wide streams
and don't do anything with the wide stuff.

2002-06-07  Jakub Jelinek  <jakub@redhat.com>

	* libio/libioP.h (_IO_wfile_jumps): Remove attribute_hidden.
	* libio/wfileops.c (_IO_wfile_setbuf): Add INTDEF.
	(_IO_wfile_jumps): Use _IO_wfile_setbuf, not _IO_new_file_setbuf
	as _IO_WSETBUF handler.
	(_IO_wfile_jumps_mmap): Cast _IO_wfile_setbuf_mmap to _IO_setbuf_t
	to avoid warnings.
	* nss/getXXbyYY_r.c (NEW, NEW1): Define.
	(NEW (REENTRANT_NAME)): Strong alias to INTERNAL (REENTRANT_NAME).
	(REENTRANT_NAME@@GLIBC_2.1.2): Use NEW (REENTRANT_NAME).
	* nss/getXXent_r.c (NEW, NEW1): Define.
	(NEW (REENTRANT_GETNAME)): Strong alias to
	INTERNAL (REENTRANT_GETNAME).
	(REENTRANT_GETNAME@@GLIBC_2.1.2): Use NEW (REENTRANT_GETNAME).

--- libc/libio/libioP.h.jj	Tue Apr 30 12:52:49 2002
+++ libc/libio/libioP.h	Fri Jun  7 11:52:12 2002
@@ -427,7 +427,7 @@ extern void _IO_default_imbue __P ((_IO_
 
 extern struct _IO_jump_t _IO_file_jumps;
 extern struct _IO_jump_t _IO_file_jumps_mmap attribute_hidden;
-extern struct _IO_jump_t _IO_wfile_jumps attribute_hidden;
+extern struct _IO_jump_t _IO_wfile_jumps;
 extern struct _IO_jump_t _IO_wfile_jumps_mmap attribute_hidden;
 extern struct _IO_jump_t _IO_old_file_jumps attribute_hidden;
 extern struct _IO_jump_t _IO_streambuf_jumps;
--- libc/libio/wfileops.c.jj	Wed Jun  5 12:07:43 2002
+++ libc/libio/wfileops.c	Fri Jun  7 11:57:00 2002
@@ -68,6 +68,7 @@ _IO_wfile_setbuf (fp, p, len)
 
   return fp;
 }
+INTDEF(_IO_wfile_setbuf)
 
 
 static _IO_FILE * _IO_wfile_setbuf_mmap __P ((_IO_FILE *, wchar_t *,
@@ -866,7 +867,7 @@ struct _IO_jump_t _IO_wfile_jumps =
   JUMP_INIT(xsgetn, INTUSE(_IO_file_xsgetn)),
   JUMP_INIT(seekoff, INTUSE(_IO_wfile_seekoff)),
   JUMP_INIT(seekpos, _IO_default_seekpos),
-  JUMP_INIT(setbuf, _IO_new_file_setbuf),
+  JUMP_INIT(setbuf, (_IO_setbuf_t) INTUSE(_IO_wfile_setbuf)),
   JUMP_INIT(sync, (_IO_sync_t) INTUSE(_IO_wfile_sync)),
   JUMP_INIT(doallocate, _IO_wfile_doallocate),
   JUMP_INIT(read, INTUSE(_IO_file_read)),
@@ -892,7 +893,7 @@ struct _IO_jump_t _IO_wfile_jumps_mmap =
   JUMP_INIT(xsgetn, INTUSE(_IO_file_xsgetn)),
   JUMP_INIT(seekoff, INTUSE(_IO_wfile_seekoff)),
   JUMP_INIT(seekpos, _IO_default_seekpos),
-  JUMP_INIT(setbuf, _IO_wfile_setbuf_mmap),
+  JUMP_INIT(setbuf, (_IO_setbuf_t) _IO_wfile_setbuf_mmap),
   JUMP_INIT(sync, (_IO_sync_t) INTUSE(_IO_wfile_sync)),
   JUMP_INIT(doallocate, _IO_wfile_doallocate),
   JUMP_INIT(read, INTUSE(_IO_file_read)),
--- libc/nss/getXXbyYY_r.c.jj	Tue Apr 30 12:53:15 2002
+++ libc/nss/getXXbyYY_r.c	Fri Jun  7 11:35:43 2002
@@ -63,6 +63,8 @@
 #define APPEND_R1(name) name##_r
 #define INTERNAL(name) INTERNAL1 (name)
 #define INTERNAL1(name) __##name
+#define NEW(name) NEW1 (name)
+#define NEW1(name) __new_##name
 
 #ifdef USE_NSCD
 # define NSCD_NAME ADD_NSCD (REENTRANT_NAME)
@@ -257,7 +259,12 @@ OLD (REENTRANT_NAME) (ADD_PARAMS, LOOKUP
 do_symbol_version (OLD (REENTRANT_NAME), REENTRANT_NAME, GLIBC_2_0);
 #endif
 
+/* As INTERNAL (REENTRANT_NAME) may be hidden, we need an alias
+   in between so that the REENTRANT_NAME@@GLIBC_2.1.2 is not
+   hidden too.  */
+strong_alias (INTERNAL (REENTRANT_NAME), NEW (REENTRANT_NAME));
+
 #define do_default_symbol_version(real, name, version) \
   versioned_symbol (libc, real, name, version)
-do_default_symbol_version (INTERNAL (REENTRANT_NAME),
+do_default_symbol_version (NEW (REENTRANT_NAME),
 			   REENTRANT_NAME, GLIBC_2_1_2);
--- libc/nss/getXXent_r.c.jj	Tue Apr 30 12:53:15 2002
+++ libc/nss/getXXent_r.c	Fri Jun  7 11:39:51 2002
@@ -53,6 +53,8 @@
 #define INTERNAL(Name) CONCAT2_2 (__, Name)
 #define CONCAT2_1(Pre, Post) CONCAT2_2 (Pre, Post)
 #define CONCAT2_2(Pre, Post) Pre##Post
+#define NEW(name) NEW1 (name)
+#define NEW1(name) __new_##name
 
 #define SETFUNC_NAME_STRING STRINGIZE (SETFUNC_NAME)
 #define GETFUNC_NAME_STRING STRINGIZE (REENTRANT_GETNAME)
@@ -189,7 +191,12 @@ OLD (REENTRANT_GETNAME) (LOOKUP_TYPE *re
 do_symbol_version (OLD (REENTRANT_GETNAME), REENTRANT_GETNAME, GLIBC_2_0);
 #endif
 
+/* As INTERNAL (REENTRANT_GETNAME) may be hidden, we need an alias
+   in between so that the REENTRANT_GETNAME@@GLIBC_2.1.2 is not
+   hidden too.  */
+strong_alias (INTERNAL (REENTRANT_GETNAME), NEW (REENTRANT_GETNAME));
+
 #define do_default_symbol_version(real, name, version) \
   versioned_symbol (libc, real, name, version)
-do_default_symbol_version (INTERNAL (REENTRANT_GETNAME),
+do_default_symbol_version (NEW (REENTRANT_GETNAME),
 			   REENTRANT_GETNAME, GLIBC_2_1_2);


	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix glibc binary compatibility problems
  2002-06-07  3:06 [PATCH] Fix glibc binary compatibility problems Jakub Jelinek
@ 2002-06-21 22:14 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2002-06-21 22:14 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Glibc hackers

[-- Attachment #1: Type: text/plain, Size: 953 bytes --]

On Fri, 2002-06-07 at 03:05, Jakub Jelinek wrote:

> readelf -a /lib/i686/libc.so.6 | grep gethostent_r | less
>   1062: 420f87e0   198 FUNC    GLOBAL DEFAULT   11 gethostent_r@GLIBC_2.0
>   1380: 420f87e0   198 FUNC    LOCAL  DEFAULT   11 __old_gethostent_r
>   1494: 420f8720   187 FUNC    LOCAL  HIDDEN   11 gethostent_r@@GLIBC_2.1.2
>   2108: 420f8720   187 FUNC    LOCAL  HIDDEN   11 __gethostent_r
>   3441: 420f87e0   198 FUNC    GLOBAL DEFAULT   11 gethostent_r@GLIBC_2.0
> and similarly for all other get*ent_r functions, plus _IO_wfile_jumps
> is not exported either but used to be (@@GLIBC_2.2).

I've applied parts of the patch.  I do not know why _IO_wfile_jumps is
needed.  What package is using it?

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-06-22  5:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-07  3:06 [PATCH] Fix glibc binary compatibility problems Jakub Jelinek
2002-06-21 22:14 ` Ulrich Drepper

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).