This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 0/5] obstacks again
- From: Alan Modra <amodra at gmail dot com>
- To: libc-alpha at sourceware dot org, bug-gnulib at gnu dot org
- Date: Wed, 29 Oct 2014 14:02:01 +1030
- Subject: [PATCH 0/5] obstacks again
- Authentication-results: sourceware.org; auth=none
This is a revised series, adding the SHLIB_COMPAT support Roland
McGrath requested for glibc, and omitting patch 5/5 in the previous
series that Paul Eggert disliked, with reason.
I've also moved as much of the glibc specific code out of gnulib as I
could, and abandoned the idea of renaming version 2 obstack functions.
Renaming was for a theoretical case where a shared library was built
both providing and using version 1 obstacks, then was linked against
an executable using version 2 obstacks, the shared lib obstack use
then being broken by its functions being overridden by the executable.
You'd need to be using a libc other than glibc, or deliberately try to
get into trouble with glibc..
I believe that gnulib is the owning project for obstack.[ch]. At
least, that's what I was told by one of the glibc maintainers. I hope
that wasn't due to glibc people being uninterested in these patches
since the gnulib people also seem uninterested in reviewing the meat
of the patch series. I'm unsure who to poke. Note that these patches
were developed in response to a legitimate use of obstacks in gdb
hitting the current 2G limit with a real-world shared library. See
gdb pr17133. Anyway, the patches are against current gnulib sources.
(glibc and gnulib differ in whitespace only.) BTW, I see gnulib has a
policy of not using tabs for indentation, but the obstack files don't
follow this for macro continuation lines, using tabs before the
backslash. I've kept to this practice but will happily fix whitespace
if asked.
The first patch renames some union fields and moves code around, and
only that. Split out to make later patches easy to review.
The second patch is mostly just a tidy, with one perhaps controversial
change, renaming the function obstack_free to _obstack_free for
consistency with other obstack functions. This will be visible to
users who compile some code using a new obstack.h and try to link
against an old (but not ancient!) relocatable obstack.o. Not a good
practice, of course. They will need to recompile their obstack.o.
Users linking against glibc won't see a problem since glibc exports
both _obstack_free and obstack_free.
The third and fourth patch get us to the point where 4G obstacks are
supported without significantly changing the ABI. At this point some
code will need fixes, due to people wrongly using obstack internals.
See https://gcc.gnu.org/ml/gcc-patches/2014-08/msg00233.html for the
gcc changes, binutils-gdb commit e57e6ddc and 241fd515 for binutils
and gdb changes. I expect there may be signed/unsigned comparison
warnings too, in other code using obstacks.
The fifth patch switches obstacks to use size_t for sizes and removes
some glibc specific code. I've also added one more macro test to
allow the obstack error code to be omitted.
The sixth patch is for glibc only. This provides wrappers for
obstack.c to hold the glibc specific code removed by the fifth patch,
plus machinery to allow obstack.c to be compiled twice. I've included
obstack.c and obstack.h diff -w there for anyone interested in the
cumulative changes. Note that this patch requires updating all the
libc abilist files. I haven't done that.
Prior to this patch series, I see the following obstack symbols
(readelf --dyn-syms --wide libc.so | grep obstack | grep -v printf
then cut symbol number and section columns)
On x86_64
000000000039eab8 8 OBJECT GLOBAL DEFAULT _obstack@GLIBC_2.2.5
000000000007f8b0 48 FUNC GLOBAL DEFAULT _obstack_allocated_p@@GLIBC_2.2.5
000000000007f680 181 FUNC GLOBAL DEFAULT _obstack_begin_1@@GLIBC_2.2.5
000000000007f740 364 FUNC GLOBAL DEFAULT _obstack_newchunk@@GLIBC_2.2.5
000000000007f960 33 FUNC GLOBAL DEFAULT _obstack_memory_used@@GLIBC_2.2.5
000000000007f8e0 117 FUNC GLOBAL DEFAULT obstack_free@@GLIBC_2.2.5
000000000039d490 8 OBJECT GLOBAL DEFAULT obstack_alloc_failed_handler@@GLIBC_2.2.5
000000000039c218 4 OBJECT GLOBAL DEFAULT obstack_exit_failure@@GLIBC_2.2.5
000000000007f5d0 173 FUNC GLOBAL DEFAULT _obstack_begin@@GLIBC_2.2.5
000000000007f8e0 117 FUNC GLOBAL DEFAULT _obstack_free@@GLIBC_2.2.5
On i686
001b0bb0 4 OBJECT GLOBAL DEFAULT _obstack@GLIBC_2.0
00076c40 48 FUNC GLOBAL DEFAULT _obstack_allocated_p@@GLIBC_2.0
00076a10 178 FUNC GLOBAL DEFAULT _obstack_begin_1@@GLIBC_2.0
00076ad0 365 FUNC GLOBAL DEFAULT _obstack_newchunk@@GLIBC_2.0
00076ce0 33 FUNC GLOBAL DEFAULT _obstack_memory_used@@GLIBC_2.0
00076c70 112 FUNC GLOBAL DEFAULT obstack_free@@GLIBC_2.0
001afc94 4 OBJECT GLOBAL DEFAULT obstack_alloc_failed_handler@@GLIBC_2.0
001af174 4 OBJECT GLOBAL DEFAULT obstack_exit_failure@@GLIBC_2.0
00076960 170 FUNC GLOBAL DEFAULT _obstack_begin@@GLIBC_2.0
00076c70 112 FUNC GLOBAL DEFAULT _obstack_free@@GLIBC_2.0
After the patch
On x86_64
000000000039eab8 8 OBJECT GLOBAL DEFAULT _obstack@GLIBC_2.2.5
000000000007f8b0 48 FUNC GLOBAL DEFAULT _obstack_allocated_p@GLIBC_2.2.5
000000000007fbd0 48 FUNC GLOBAL DEFAULT _obstack_allocated_p@@GLIBC_2.21
000000000007f780 13 FUNC GLOBAL DEFAULT _obstack_begin_1@GLIBC_2.2.5
000000000007faa0 13 FUNC GLOBAL DEFAULT _obstack_begin_1@@GLIBC_2.21
000000000007f790 284 FUNC GLOBAL DEFAULT _obstack_newchunk@GLIBC_2.2.5
000000000007fab0 284 FUNC GLOBAL DEFAULT _obstack_newchunk@@GLIBC_2.21
000000000007f960 33 FUNC GLOBAL DEFAULT _obstack_memory_used@GLIBC_2.2.5
000000000007fc80 38 FUNC GLOBAL DEFAULT _obstack_memory_used@@GLIBC_2.21
000000000007f8e0 117 FUNC GLOBAL DEFAULT obstack_free@GLIBC_2.2.5
000000000039d490 8 OBJECT GLOBAL DEFAULT obstack_alloc_failed_handler@@GLIBC_2.2.5
000000000039c218 4 OBJECT GLOBAL DEFAULT obstack_exit_failure@@GLIBC_2.2.5
000000000007f770 9 FUNC GLOBAL DEFAULT _obstack_begin@GLIBC_2.2.5
000000000007fa90 9 FUNC GLOBAL DEFAULT _obstack_begin@@GLIBC_2.21
000000000007f8e0 117 FUNC GLOBAL DEFAULT _obstack_free@GLIBC_2.2.5
000000000007fc00 117 FUNC GLOBAL DEFAULT _obstack_free@@GLIBC_2.21
On i686
001b1bb0 4 OBJECT GLOBAL DEFAULT _obstack@GLIBC_2.0
00076c20 48 FUNC GLOBAL DEFAULT _obstack_allocated_p@@GLIBC_2.0
00076a90 50 FUNC GLOBAL DEFAULT _obstack_begin_1@@GLIBC_2.0
00076ad0 322 FUNC GLOBAL DEFAULT _obstack_newchunk@@GLIBC_2.0
00076cc0 33 FUNC GLOBAL DEFAULT _obstack_memory_used@@GLIBC_2.0
00076c50 112 FUNC GLOBAL DEFAULT obstack_free@GLIBC_2.0
001b0c94 4 OBJECT GLOBAL DEFAULT obstack_alloc_failed_handler@@GLIBC_2.0
001b0174 4 OBJECT GLOBAL DEFAULT obstack_exit_failure@@GLIBC_2.0
00076a60 43 FUNC GLOBAL DEFAULT _obstack_begin@@GLIBC_2.0
00076c50 112 FUNC GLOBAL DEFAULT _obstack_free@@GLIBC_2.0
Patch plus some tweaks
with _GNU_OBSTACK_INTERFACE_VERSION==1 on x86_64
000000000039eab8 8 OBJECT GLOBAL DEFAULT _obstack@GLIBC_2.2.5
000000000007f840 48 FUNC GLOBAL DEFAULT _obstack_allocated_p@@GLIBC_2.2.5
000000000007f710 13 FUNC GLOBAL DEFAULT _obstack_begin_1@@GLIBC_2.2.5
000000000007f720 284 FUNC GLOBAL DEFAULT _obstack_newchunk@@GLIBC_2.2.5
000000000007f8f0 33 FUNC GLOBAL DEFAULT _obstack_memory_used@@GLIBC_2.2.5
000000000007f870 117 FUNC GLOBAL DEFAULT obstack_free@GLIBC_2.2.5
000000000039d490 8 OBJECT GLOBAL DEFAULT obstack_alloc_failed_handler@@GLIBC_2.2.5
000000000039c218 4 OBJECT GLOBAL DEFAULT obstack_exit_failure@@GLIBC_2.2.5
000000000007f700 9 FUNC GLOBAL DEFAULT _obstack_begin@@GLIBC_2.2.5
000000000007f870 117 FUNC GLOBAL DEFAULT _obstack_free@@GLIBC_2.2.5
with _GNU_OBSTACK_INTERFACE_VERSION==1 on i686
001b1bb0 4 OBJECT GLOBAL DEFAULT _obstack@GLIBC_2.0
00076c20 48 FUNC GLOBAL DEFAULT _obstack_allocated_p@@GLIBC_2.0
00076a90 50 FUNC GLOBAL DEFAULT _obstack_begin_1@@GLIBC_2.0
00076ad0 322 FUNC GLOBAL DEFAULT _obstack_newchunk@@GLIBC_2.0
00076cc0 33 FUNC GLOBAL DEFAULT _obstack_memory_used@@GLIBC_2.0
00076c50 112 FUNC GLOBAL DEFAULT obstack_free@GLIBC_2.0
001b0c94 4 OBJECT GLOBAL DEFAULT obstack_alloc_failed_handler@@GLIBC_2.0
001b0174 4 OBJECT GLOBAL DEFAULT obstack_exit_failure@@GLIBC_2.0
00076a60 43 FUNC GLOBAL DEFAULT _obstack_begin@@GLIBC_2.0
00076c50 112 FUNC GLOBAL DEFAULT _obstack_free@@GLIBC_2.0
with DEFAULT GLIBC_2.21 in shlib_versions (make others fails, but hey,
we're testing odd things out) x86_64
000000000007eb20 48 FUNC GLOBAL DEFAULT _obstack_allocated_p@@GLIBC_2.21
000000000007e9f0 13 FUNC GLOBAL DEFAULT _obstack_begin_1@@GLIBC_2.21
000000000007ea00 284 FUNC GLOBAL DEFAULT _obstack_newchunk@@GLIBC_2.21
000000000007ebd0 38 FUNC GLOBAL DEFAULT _obstack_memory_used@@GLIBC_2.21
000000000039c410 8 OBJECT GLOBAL DEFAULT obstack_alloc_failed_handler@@GLIBC_2.21
000000000039b218 4 OBJECT GLOBAL DEFAULT obstack_exit_failure@@GLIBC_2.21
000000000007e9e0 9 FUNC GLOBAL DEFAULT _obstack_begin@@GLIBC_2.21
000000000007eb50 117 FUNC GLOBAL DEFAULT _obstack_free@@GLIBC_2.21
DEFAULT GLIBC_2.21 in shlib_versions on i686 fails to build libc.so,
but obstack object files look good.
/home/alan/build/glibc32/libc_pic.a(setrlimit.os):/src/glibc-current/resource/../sysdeps/unix/syscall-template.S:81: multiple definition of `setrlimit@GLIBC_2.21'
/home/alan/build/glibc32/libc_pic.a(setrlimit.os):/src/glibc-current/resource/../sysdeps/unix/syscall-template.S:81: first defined here
/home/alan/build/glibc32/libc_pic.a(vm86old.os): In function `__vm86old':
/src/glibc-current/misc/../sysdeps/unix/syscall-template.S:81: multiple definition of `vm86@GLIBC_2.21'
/home/alan/build/glibc32/libc_pic.a(oldgetrlimit.os): In function `__old_getrlimit':
/src/glibc-current/misc/../sysdeps/unix/syscall-template.S:81: multiple definition of `getrlimit@GLIBC_2.21'
Alan Modra (5):
obstack tidy part 1
obstack tidy part 2
64-bit obstack support, part 1
64-bit obstack support, part 2
64-bit obstack support, part 3
lib/obstack.c | 236 ++++++++++++++++++++--------------------------------------
lib/obstack.h | 191 ++++++++++++++++++++++++-----------------------
2 files changed, 178 insertions(+), 249 deletions(-)
--
Alan Modra
Australia Development Lab, IBM