* update glibc to 2.38-3
This commit is contained in:
parent
11f701b0e7
commit
33ae309047
@ -10,8 +10,8 @@
|
||||
pkgbase=glibc
|
||||
pkgname=(glibc)
|
||||
[ "${CARCH}" = 'x86_64' ] && pkgname+=(lib32-glibc)
|
||||
pkgver=2.37
|
||||
_commit=7c32cb7dd88cf100b0b412163896e30aa2ee671a
|
||||
pkgver=2.38
|
||||
_commit=6b99458d197ab779ebb6ff632c168e2cbfa4f543
|
||||
pkgrel=3
|
||||
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
|
||||
url='https://www.gnu.org/software/libc'
|
||||
@ -25,6 +25,8 @@ source=(git+https://sourceware.org/git/glibc.git#commit=${_commit}
|
||||
lib32-glibc.conf
|
||||
sdt.h sdt-config.h
|
||||
reenable_DT_HASH.patch
|
||||
fix-malloc-p1.patch
|
||||
fix-malloc-p2.patch
|
||||
)
|
||||
validpgpkeys=(7273542B39962DF7B299931416792B4EA25340F8 # Carlos O'Donell
|
||||
BC7C7372637EC10C57D7AA6579C43DFBF1CF2187) # Siddhesh Poyarekar
|
||||
@ -34,7 +36,9 @@ b2sums=('SKIP'
|
||||
'7c265e6d36a5c0dff127093580827d15519b6c7205c2e1300e82f0fb5b9dd00b6accb40c56581f18179c4fbbc95bd2bf1b900ace867a83accde0969f7b609f8a'
|
||||
'a6a5e2f2a627cc0d13d11a82458cfd0aa75ec1c5a3c7647e5d5a3bb1d4c0770887a3909bfda1236803d5bc9801bfd6251e13483e9adf797e4725332cd0d91a0e'
|
||||
'214e995e84b342fe7b2a7704ce011b7c7fc74c2971f98eeb3b4e677b99c860addc0a7d91b8dc0f0b8be7537782ee331999e02ba48f4ccc1c331b60f27d715678'
|
||||
'5fdd133c367af2f5454ea1eea7907de12166fb95eb59dbe33eae16aa9e26209b6585972bc1c80e36a0af4bfb04296acaf940ee78cd624cdcbab9669dff46c051')
|
||||
'35e03ed912e1b0cd23783ab83ce919412885c141344905b8b67bbad4a86c48cf3e893806060e48d5737514ff80cea0b58b0e1f15707c32224579c416dcd810c0'
|
||||
'28c983bcebc0eeeb37a60756ccee50d587a99d5e2100430d5c0ee51a19d9b2176a4013574a7d72b5857302fbb60d371bbf0b3cdb4fc700a1dbe3aae4a42b04b9'
|
||||
'c3e94f5b0999878ff472e32f49dc13c20eb9db68c633017cb7824617eb824cf6cff7ea53b92962926e0ee84fd39736616298dcb926356625dd124f3754e79932')
|
||||
|
||||
prepare() {
|
||||
mkdir -p glibc-build
|
||||
@ -43,10 +47,13 @@ prepare() {
|
||||
[[ -d glibc-$pkgver ]] && ln -s glibc-$pkgver glibc
|
||||
cd glibc
|
||||
|
||||
# re-enable `--hash-style=both` for building shared objects due to issues with EPIC's EAC
|
||||
# Re-enable `--hash-style=both` for building shared objects due to issues with EPIC's EAC
|
||||
# which relies on DT_HASH to be present in these libs.
|
||||
# reconsider 2023-01
|
||||
patch -Np1 -i "${srcdir}"/reenable_DT_HASH.patch
|
||||
|
||||
patch -Np1 -i "${srcdir}"/fix-malloc-p1.patch
|
||||
patch -Np1 -i "${srcdir}"/fix-malloc-p2.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
@ -58,11 +65,11 @@ build() {
|
||||
--with-bugurl=https://github.com/kth5/archpower/issues
|
||||
--with-pkgversion="ArchPOWER GLIBC ${pkgver}"
|
||||
--enable-bind-now
|
||||
--enable-fortify-source
|
||||
--enable-kernel=4.4
|
||||
--enable-stack-protector=strong
|
||||
--enable-systemtap
|
||||
--disable-profile
|
||||
--disable-crypt
|
||||
--disable-werror
|
||||
)
|
||||
|
||||
@ -72,7 +79,7 @@ build() {
|
||||
*) _configure_flags+=(--disable-multi-arch); CFLAGS='-O2 -pipe' ;;
|
||||
esac
|
||||
|
||||
cd "${srcdir}/glibc-build"
|
||||
cd "${srcdir}"/glibc-build
|
||||
|
||||
echo "slibdir=/usr/lib" >> configparms
|
||||
echo "rtlddir=/usr/lib" >> configparms
|
||||
@ -82,27 +89,20 @@ build() {
|
||||
# Credits @allanmcrae
|
||||
# https://github.com/allanmcrae/toolchain/blob/f18604d70c5933c31b51a320978711e4e6791cf1/glibc/PKGBUILD
|
||||
# remove fortify for building libraries
|
||||
CFLAGS=${CFLAGS/-Wp,-D_FORTIFY_SOURCE=2/}
|
||||
# CFLAGS=${CFLAGS/-Wp,-D_FORTIFY_SOURCE=2/}
|
||||
|
||||
"${srcdir}/glibc/configure" \
|
||||
"${srcdir}"/glibc/configure \
|
||||
--libdir=/usr/lib \
|
||||
--libexecdir=/usr/lib \
|
||||
"${_configure_flags[@]}"
|
||||
|
||||
# build libraries with fortify disabled
|
||||
echo "build-programs=no" >> configparms
|
||||
make -O
|
||||
|
||||
# re-enable fortify for programs
|
||||
sed -i "/build-programs=/s#no#yes#" configparms
|
||||
echo "CFLAGS += -Wp,-D_FORTIFY_SOURCE=2" >> configparms
|
||||
make -O
|
||||
|
||||
# build info pages manually for reproducibility
|
||||
make info
|
||||
|
||||
if [ "${CARCH}" = 'x86_64' ]; then
|
||||
cd "${srcdir}/lib32-glibc-build"
|
||||
cd "${srcdir}"/lib32-glibc-build
|
||||
export CC="gcc -m32 -mstackrealign"
|
||||
export CXX="g++ -m32 -mstackrealign"
|
||||
|
||||
@ -111,24 +111,17 @@ build() {
|
||||
echo "sbindir=/usr/bin" >> configparms
|
||||
echo "rootsbindir=/usr/bin" >> configparms
|
||||
|
||||
"${srcdir}/glibc/configure" \
|
||||
"${srcdir}"/glibc/configure \
|
||||
--host=i686-pc-linux-gnu \
|
||||
--libdir=/usr/lib32 \
|
||||
--libexecdir=/usr/lib32 \
|
||||
"${_configure_flags[@]}"
|
||||
|
||||
# build libraries with fortify disabled
|
||||
echo "build-programs=no" >> configparms
|
||||
make -O
|
||||
|
||||
# re-enable fortify for programs
|
||||
sed -i "/build-programs=/s#no#yes#" configparms
|
||||
echo "CFLAGS += -Wp,-D_FORTIFY_SOURCE=2" >> configparms
|
||||
make -O
|
||||
fi
|
||||
|
||||
# pregenerate C.UTF-8 locale until it is built into glibc
|
||||
# (https://sourceware.org/glibc/wiki/Proposals/C.UTF-8, FS#74864)
|
||||
# (https://sourceware.org/glibc/wiki/Proposals/C.UTF-8, FS#74864)-
|
||||
elf/ld.so --library-path "$PWD" locale/localedef -c -f ../glibc/localedata/charmaps/UTF-8 -i ../glibc/localedata/locales/C ../C.UTF-8/
|
||||
}
|
||||
|
||||
@ -137,7 +130,7 @@ build() {
|
||||
skip_test() {
|
||||
test=${1}
|
||||
file=${2}
|
||||
sed -i "s/\b${test}\b//" "${srcdir}"/glibc/${file}
|
||||
sed -i "/\b${test} /d" "${srcdir}"/glibc/${file}
|
||||
}
|
||||
|
||||
check() {
|
||||
@ -160,7 +153,6 @@ check() {
|
||||
skip_test tst-pkey sysdeps/unix/sysv/linux/Makefile
|
||||
skip_test tst-process_mrelease sysdeps/unix/sysv/linux/Makefile
|
||||
skip_test tst-adjtime time/Makefile
|
||||
skip_test tst-clock2 time/Makefile
|
||||
|
||||
make -O check
|
||||
}
|
||||
|
294
glibc/fix-malloc-p1.patch
Normal file
294
glibc/fix-malloc-p1.patch
Normal file
@ -0,0 +1,294 @@
|
||||
commit 542b1105852568c3ebc712225ae78b8c8ba31a78
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri Aug 11 11:18:17 2023 +0200
|
||||
|
||||
malloc: Enable merging of remainders in memalign (bug 30723)
|
||||
|
||||
Previously, calling _int_free from _int_memalign could put remainders
|
||||
into the tcache or into fastbins, where they are invisible to the
|
||||
low-level allocator. This results in missed merge opportunities
|
||||
because once these freed chunks become available to the low-level
|
||||
allocator, further memalign allocations (even of the same size are)
|
||||
likely obstructing merges.
|
||||
|
||||
Furthermore, during forwards merging in _int_memalign, do not
|
||||
completely give up when the remainder is too small to serve as a
|
||||
chunk on its own. We can still give it back if it can be merged
|
||||
with the following unused chunk. This makes it more likely that
|
||||
memalign calls in a loop achieve a compact memory layout,
|
||||
independently of initial heap layout.
|
||||
|
||||
Drop some useless (unsigned long) casts along the way, and tweak
|
||||
the style to more closely match GNU on changed lines.
|
||||
|
||||
Reviewed-by: DJ Delorie <dj@redhat.com>
|
||||
|
||||
diff --git a/malloc/malloc.c b/malloc/malloc.c
|
||||
index e2f1a615a4..948f9759af 100644
|
||||
--- a/malloc/malloc.c
|
||||
+++ b/malloc/malloc.c
|
||||
@@ -1086,6 +1086,11 @@ typedef struct malloc_chunk* mchunkptr;
|
||||
|
||||
static void* _int_malloc(mstate, size_t);
|
||||
static void _int_free(mstate, mchunkptr, int);
|
||||
+static void _int_free_merge_chunk (mstate, mchunkptr, INTERNAL_SIZE_T);
|
||||
+static INTERNAL_SIZE_T _int_free_create_chunk (mstate,
|
||||
+ mchunkptr, INTERNAL_SIZE_T,
|
||||
+ mchunkptr, INTERNAL_SIZE_T);
|
||||
+static void _int_free_maybe_consolidate (mstate, INTERNAL_SIZE_T);
|
||||
static void* _int_realloc(mstate, mchunkptr, INTERNAL_SIZE_T,
|
||||
INTERNAL_SIZE_T);
|
||||
static void* _int_memalign(mstate, size_t, size_t);
|
||||
@@ -4637,31 +4642,52 @@ _int_free (mstate av, mchunkptr p, int have_lock)
|
||||
if (!have_lock)
|
||||
__libc_lock_lock (av->mutex);
|
||||
|
||||
- nextchunk = chunk_at_offset(p, size);
|
||||
-
|
||||
- /* Lightweight tests: check whether the block is already the
|
||||
- top block. */
|
||||
- if (__glibc_unlikely (p == av->top))
|
||||
- malloc_printerr ("double free or corruption (top)");
|
||||
- /* Or whether the next chunk is beyond the boundaries of the arena. */
|
||||
- if (__builtin_expect (contiguous (av)
|
||||
- && (char *) nextchunk
|
||||
- >= ((char *) av->top + chunksize(av->top)), 0))
|
||||
- malloc_printerr ("double free or corruption (out)");
|
||||
- /* Or whether the block is actually not marked used. */
|
||||
- if (__glibc_unlikely (!prev_inuse(nextchunk)))
|
||||
- malloc_printerr ("double free or corruption (!prev)");
|
||||
-
|
||||
- nextsize = chunksize(nextchunk);
|
||||
- if (__builtin_expect (chunksize_nomask (nextchunk) <= CHUNK_HDR_SZ, 0)
|
||||
- || __builtin_expect (nextsize >= av->system_mem, 0))
|
||||
- malloc_printerr ("free(): invalid next size (normal)");
|
||||
+ _int_free_merge_chunk (av, p, size);
|
||||
|
||||
- free_perturb (chunk2mem(p), size - CHUNK_HDR_SZ);
|
||||
+ if (!have_lock)
|
||||
+ __libc_lock_unlock (av->mutex);
|
||||
+ }
|
||||
+ /*
|
||||
+ If the chunk was allocated via mmap, release via munmap().
|
||||
+ */
|
||||
+
|
||||
+ else {
|
||||
+ munmap_chunk (p);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* Try to merge chunk P of SIZE bytes with its neighbors. Put the
|
||||
+ resulting chunk on the appropriate bin list. P must not be on a
|
||||
+ bin list yet, and it can be in use. */
|
||||
+static void
|
||||
+_int_free_merge_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T size)
|
||||
+{
|
||||
+ mchunkptr nextchunk = chunk_at_offset(p, size);
|
||||
+
|
||||
+ /* Lightweight tests: check whether the block is already the
|
||||
+ top block. */
|
||||
+ if (__glibc_unlikely (p == av->top))
|
||||
+ malloc_printerr ("double free or corruption (top)");
|
||||
+ /* Or whether the next chunk is beyond the boundaries of the arena. */
|
||||
+ if (__builtin_expect (contiguous (av)
|
||||
+ && (char *) nextchunk
|
||||
+ >= ((char *) av->top + chunksize(av->top)), 0))
|
||||
+ malloc_printerr ("double free or corruption (out)");
|
||||
+ /* Or whether the block is actually not marked used. */
|
||||
+ if (__glibc_unlikely (!prev_inuse(nextchunk)))
|
||||
+ malloc_printerr ("double free or corruption (!prev)");
|
||||
+
|
||||
+ INTERNAL_SIZE_T nextsize = chunksize(nextchunk);
|
||||
+ if (__builtin_expect (chunksize_nomask (nextchunk) <= CHUNK_HDR_SZ, 0)
|
||||
+ || __builtin_expect (nextsize >= av->system_mem, 0))
|
||||
+ malloc_printerr ("free(): invalid next size (normal)");
|
||||
+
|
||||
+ free_perturb (chunk2mem(p), size - CHUNK_HDR_SZ);
|
||||
|
||||
- /* consolidate backward */
|
||||
- if (!prev_inuse(p)) {
|
||||
- prevsize = prev_size (p);
|
||||
+ /* Consolidate backward. */
|
||||
+ if (!prev_inuse(p))
|
||||
+ {
|
||||
+ INTERNAL_SIZE_T prevsize = prev_size (p);
|
||||
size += prevsize;
|
||||
p = chunk_at_offset(p, -((long) prevsize));
|
||||
if (__glibc_unlikely (chunksize(p) != prevsize))
|
||||
@@ -4669,9 +4695,25 @@ _int_free (mstate av, mchunkptr p, int have_lock)
|
||||
unlink_chunk (av, p);
|
||||
}
|
||||
|
||||
- if (nextchunk != av->top) {
|
||||
+ /* Write the chunk header, maybe after merging with the following chunk. */
|
||||
+ size = _int_free_create_chunk (av, p, size, nextchunk, nextsize);
|
||||
+ _int_free_maybe_consolidate (av, size);
|
||||
+}
|
||||
+
|
||||
+/* Create a chunk at P of SIZE bytes, with SIZE potentially increased
|
||||
+ to cover the immediately following chunk NEXTCHUNK of NEXTSIZE
|
||||
+ bytes (if NEXTCHUNK is unused). The chunk at P is not actually
|
||||
+ read and does not have to be initialized. After creation, it is
|
||||
+ placed on the appropriate bin list. The function returns the size
|
||||
+ of the new chunk. */
|
||||
+static INTERNAL_SIZE_T
|
||||
+_int_free_create_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T size,
|
||||
+ mchunkptr nextchunk, INTERNAL_SIZE_T nextsize)
|
||||
+{
|
||||
+ if (nextchunk != av->top)
|
||||
+ {
|
||||
/* get and clear inuse bit */
|
||||
- nextinuse = inuse_bit_at_offset(nextchunk, nextsize);
|
||||
+ bool nextinuse = inuse_bit_at_offset (nextchunk, nextsize);
|
||||
|
||||
/* consolidate forward */
|
||||
if (!nextinuse) {
|
||||
@@ -4686,8 +4728,8 @@ _int_free (mstate av, mchunkptr p, int have_lock)
|
||||
been given one chance to be used in malloc.
|
||||
*/
|
||||
|
||||
- bck = unsorted_chunks(av);
|
||||
- fwd = bck->fd;
|
||||
+ mchunkptr bck = unsorted_chunks (av);
|
||||
+ mchunkptr fwd = bck->fd;
|
||||
if (__glibc_unlikely (fwd->bk != bck))
|
||||
malloc_printerr ("free(): corrupted unsorted chunks");
|
||||
p->fd = fwd;
|
||||
@@ -4706,61 +4748,52 @@ _int_free (mstate av, mchunkptr p, int have_lock)
|
||||
check_free_chunk(av, p);
|
||||
}
|
||||
|
||||
- /*
|
||||
- If the chunk borders the current high end of memory,
|
||||
- consolidate into top
|
||||
- */
|
||||
-
|
||||
- else {
|
||||
+ else
|
||||
+ {
|
||||
+ /* If the chunk borders the current high end of memory,
|
||||
+ consolidate into top. */
|
||||
size += nextsize;
|
||||
set_head(p, size | PREV_INUSE);
|
||||
av->top = p;
|
||||
check_chunk(av, p);
|
||||
}
|
||||
|
||||
- /*
|
||||
- If freeing a large space, consolidate possibly-surrounding
|
||||
- chunks. Then, if the total unused topmost memory exceeds trim
|
||||
- threshold, ask malloc_trim to reduce top.
|
||||
-
|
||||
- Unless max_fast is 0, we don't know if there are fastbins
|
||||
- bordering top, so we cannot tell for sure whether threshold
|
||||
- has been reached unless fastbins are consolidated. But we
|
||||
- don't want to consolidate on each free. As a compromise,
|
||||
- consolidation is performed if FASTBIN_CONSOLIDATION_THRESHOLD
|
||||
- is reached.
|
||||
- */
|
||||
+ return size;
|
||||
+}
|
||||
|
||||
- if ((unsigned long)(size) >= FASTBIN_CONSOLIDATION_THRESHOLD) {
|
||||
+/* If freeing a large space, consolidate possibly-surrounding
|
||||
+ chunks. Then, if the total unused topmost memory exceeds trim
|
||||
+ threshold, ask malloc_trim to reduce top. */
|
||||
+static void
|
||||
+_int_free_maybe_consolidate (mstate av, INTERNAL_SIZE_T size)
|
||||
+{
|
||||
+ /* Unless max_fast is 0, we don't know if there are fastbins
|
||||
+ bordering top, so we cannot tell for sure whether threshold has
|
||||
+ been reached unless fastbins are consolidated. But we don't want
|
||||
+ to consolidate on each free. As a compromise, consolidation is
|
||||
+ performed if FASTBIN_CONSOLIDATION_THRESHOLD is reached. */
|
||||
+ if (size >= FASTBIN_CONSOLIDATION_THRESHOLD)
|
||||
+ {
|
||||
if (atomic_load_relaxed (&av->have_fastchunks))
|
||||
malloc_consolidate(av);
|
||||
|
||||
- if (av == &main_arena) {
|
||||
+ if (av == &main_arena)
|
||||
+ {
|
||||
#ifndef MORECORE_CANNOT_TRIM
|
||||
- if ((unsigned long)(chunksize(av->top)) >=
|
||||
- (unsigned long)(mp_.trim_threshold))
|
||||
- systrim(mp_.top_pad, av);
|
||||
+ if (chunksize (av->top) >= mp_.trim_threshold)
|
||||
+ systrim (mp_.top_pad, av);
|
||||
#endif
|
||||
- } else {
|
||||
- /* Always try heap_trim(), even if the top chunk is not
|
||||
- large, because the corresponding heap might go away. */
|
||||
- heap_info *heap = heap_for_ptr(top(av));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* Always try heap_trim, even if the top chunk is not large,
|
||||
+ because the corresponding heap might go away. */
|
||||
+ heap_info *heap = heap_for_ptr (top (av));
|
||||
|
||||
- assert(heap->ar_ptr == av);
|
||||
- heap_trim(heap, mp_.top_pad);
|
||||
- }
|
||||
+ assert (heap->ar_ptr == av);
|
||||
+ heap_trim (heap, mp_.top_pad);
|
||||
+ }
|
||||
}
|
||||
-
|
||||
- if (!have_lock)
|
||||
- __libc_lock_unlock (av->mutex);
|
||||
- }
|
||||
- /*
|
||||
- If the chunk was allocated via mmap, release via munmap().
|
||||
- */
|
||||
-
|
||||
- else {
|
||||
- munmap_chunk (p);
|
||||
- }
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -5221,7 +5254,7 @@ _int_memalign (mstate av, size_t alignment, size_t bytes)
|
||||
(av != &main_arena ? NON_MAIN_ARENA : 0));
|
||||
set_inuse_bit_at_offset (newp, newsize);
|
||||
set_head_size (p, leadsize | (av != &main_arena ? NON_MAIN_ARENA : 0));
|
||||
- _int_free (av, p, 1);
|
||||
+ _int_free_merge_chunk (av, p, leadsize);
|
||||
p = newp;
|
||||
|
||||
assert (newsize >= nb &&
|
||||
@@ -5232,15 +5265,27 @@ _int_memalign (mstate av, size_t alignment, size_t bytes)
|
||||
if (!chunk_is_mmapped (p))
|
||||
{
|
||||
size = chunksize (p);
|
||||
- if ((unsigned long) (size) > (unsigned long) (nb + MINSIZE))
|
||||
+ mchunkptr nextchunk = chunk_at_offset(p, size);
|
||||
+ INTERNAL_SIZE_T nextsize = chunksize(nextchunk);
|
||||
+ if (size > nb)
|
||||
{
|
||||
remainder_size = size - nb;
|
||||
- remainder = chunk_at_offset (p, nb);
|
||||
- set_head (remainder, remainder_size | PREV_INUSE |
|
||||
- (av != &main_arena ? NON_MAIN_ARENA : 0));
|
||||
- set_head_size (p, nb);
|
||||
- _int_free (av, remainder, 1);
|
||||
- }
|
||||
+ if (remainder_size >= MINSIZE
|
||||
+ || nextchunk == av->top
|
||||
+ || !inuse_bit_at_offset (nextchunk, nextsize))
|
||||
+ {
|
||||
+ /* We can only give back the tail if it is larger than
|
||||
+ MINSIZE, or if the following chunk is unused (top
|
||||
+ chunk or unused in-heap chunk). Otherwise we would
|
||||
+ create a chunk that is smaller than MINSIZE. */
|
||||
+ remainder = chunk_at_offset (p, nb);
|
||||
+ set_head_size (p, nb);
|
||||
+ remainder_size = _int_free_create_chunk (av, remainder,
|
||||
+ remainder_size,
|
||||
+ nextchunk, nextsize);
|
||||
+ _int_free_maybe_consolidate (av, remainder_size);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
check_inuse_chunk (av, p);
|
249
glibc/fix-malloc-p2.patch
Normal file
249
glibc/fix-malloc-p2.patch
Normal file
@ -0,0 +1,249 @@
|
||||
commit 0dc7fc1cf094406a138e4d1bcf9553e59edcf89d
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Thu Aug 10 19:36:56 2023 +0200
|
||||
|
||||
malloc: Remove bin scanning from memalign (bug 30723)
|
||||
|
||||
On the test workload (mpv --cache=yes with VP9 video decoding), the
|
||||
bin scanning has a very poor success rate (less than 2%). The tcache
|
||||
scanning has about 50% success rate, so keep that.
|
||||
|
||||
Update comments in malloc/tst-memalign-2 to indicate the purpose
|
||||
of the tests. Even with the scanning removed, the additional
|
||||
merging opportunities since commit 542b1105852568c3ebc712225ae78b
|
||||
("malloc: Enable merging of remainders in memalign (bug 30723)")
|
||||
are sufficient to pass the existing large bins test.
|
||||
|
||||
Remove leftover variables from _int_free from refactoring in the
|
||||
same commit.
|
||||
|
||||
Reviewed-by: DJ Delorie <dj@redhat.com>
|
||||
|
||||
diff --git a/malloc/malloc.c b/malloc/malloc.c
|
||||
index 948f9759af..d0bbbf3710 100644
|
||||
--- a/malloc/malloc.c
|
||||
+++ b/malloc/malloc.c
|
||||
@@ -4488,12 +4488,6 @@ _int_free (mstate av, mchunkptr p, int have_lock)
|
||||
{
|
||||
INTERNAL_SIZE_T size; /* its size */
|
||||
mfastbinptr *fb; /* associated fastbin */
|
||||
- mchunkptr nextchunk; /* next contiguous chunk */
|
||||
- INTERNAL_SIZE_T nextsize; /* its size */
|
||||
- int nextinuse; /* true if nextchunk is used */
|
||||
- INTERNAL_SIZE_T prevsize; /* size of previous contiguous chunk */
|
||||
- mchunkptr bck; /* misc temp for linking */
|
||||
- mchunkptr fwd; /* misc temp for linking */
|
||||
|
||||
size = chunksize (p);
|
||||
|
||||
@@ -5032,42 +5026,6 @@ _int_realloc (mstate av, mchunkptr oldp, INTERNAL_SIZE_T oldsize,
|
||||
------------------------------ memalign ------------------------------
|
||||
*/
|
||||
|
||||
-/* Returns 0 if the chunk is not and does not contain the requested
|
||||
- aligned sub-chunk, else returns the amount of "waste" from
|
||||
- trimming. NB is the *chunk* byte size, not the user byte
|
||||
- size. */
|
||||
-static size_t
|
||||
-chunk_ok_for_memalign (mchunkptr p, size_t alignment, size_t nb)
|
||||
-{
|
||||
- void *m = chunk2mem (p);
|
||||
- INTERNAL_SIZE_T size = chunksize (p);
|
||||
- void *aligned_m = m;
|
||||
-
|
||||
- if (__glibc_unlikely (misaligned_chunk (p)))
|
||||
- malloc_printerr ("_int_memalign(): unaligned chunk detected");
|
||||
-
|
||||
- aligned_m = PTR_ALIGN_UP (m, alignment);
|
||||
-
|
||||
- INTERNAL_SIZE_T front_extra = (intptr_t) aligned_m - (intptr_t) m;
|
||||
-
|
||||
- /* We can't trim off the front as it's too small. */
|
||||
- if (front_extra > 0 && front_extra < MINSIZE)
|
||||
- return 0;
|
||||
-
|
||||
- /* If it's a perfect fit, it's an exception to the return value rule
|
||||
- (we would return zero waste, which looks like "not usable"), so
|
||||
- handle it here by returning a small non-zero value instead. */
|
||||
- if (size == nb && front_extra == 0)
|
||||
- return 1;
|
||||
-
|
||||
- /* If the block we need fits in the chunk, calculate total waste. */
|
||||
- if (size > nb + front_extra)
|
||||
- return size - nb;
|
||||
-
|
||||
- /* Can't use this chunk. */
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
/* BYTES is user requested bytes, not requested chunksize bytes. */
|
||||
static void *
|
||||
_int_memalign (mstate av, size_t alignment, size_t bytes)
|
||||
@@ -5082,7 +5040,6 @@ _int_memalign (mstate av, size_t alignment, size_t bytes)
|
||||
mchunkptr remainder; /* spare room at end to split off */
|
||||
unsigned long remainder_size; /* its size */
|
||||
INTERNAL_SIZE_T size;
|
||||
- mchunkptr victim;
|
||||
|
||||
nb = checked_request2size (bytes);
|
||||
if (nb == 0)
|
||||
@@ -5101,129 +5058,13 @@ _int_memalign (mstate av, size_t alignment, size_t bytes)
|
||||
we don't find anything in those bins, the common malloc code will
|
||||
scan starting at 2x. */
|
||||
|
||||
- /* This will be set if we found a candidate chunk. */
|
||||
- victim = NULL;
|
||||
-
|
||||
- /* Fast bins are singly-linked, hard to remove a chunk from the middle
|
||||
- and unlikely to meet our alignment requirements. We have not done
|
||||
- any experimentation with searching for aligned fastbins. */
|
||||
-
|
||||
- if (av != NULL)
|
||||
- {
|
||||
- int first_bin_index;
|
||||
- int first_largebin_index;
|
||||
- int last_bin_index;
|
||||
-
|
||||
- if (in_smallbin_range (nb))
|
||||
- first_bin_index = smallbin_index (nb);
|
||||
- else
|
||||
- first_bin_index = largebin_index (nb);
|
||||
-
|
||||
- if (in_smallbin_range (nb * 2))
|
||||
- last_bin_index = smallbin_index (nb * 2);
|
||||
- else
|
||||
- last_bin_index = largebin_index (nb * 2);
|
||||
-
|
||||
- first_largebin_index = largebin_index (MIN_LARGE_SIZE);
|
||||
-
|
||||
- int victim_index; /* its bin index */
|
||||
-
|
||||
- for (victim_index = first_bin_index;
|
||||
- victim_index < last_bin_index;
|
||||
- victim_index ++)
|
||||
- {
|
||||
- victim = NULL;
|
||||
-
|
||||
- if (victim_index < first_largebin_index)
|
||||
- {
|
||||
- /* Check small bins. Small bin chunks are doubly-linked despite
|
||||
- being the same size. */
|
||||
-
|
||||
- mchunkptr fwd; /* misc temp for linking */
|
||||
- mchunkptr bck; /* misc temp for linking */
|
||||
-
|
||||
- bck = bin_at (av, victim_index);
|
||||
- fwd = bck->fd;
|
||||
- while (fwd != bck)
|
||||
- {
|
||||
- if (chunk_ok_for_memalign (fwd, alignment, nb) > 0)
|
||||
- {
|
||||
- victim = fwd;
|
||||
-
|
||||
- /* Unlink it */
|
||||
- victim->fd->bk = victim->bk;
|
||||
- victim->bk->fd = victim->fd;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- fwd = fwd->fd;
|
||||
- }
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- /* Check large bins. */
|
||||
- mchunkptr fwd; /* misc temp for linking */
|
||||
- mchunkptr bck; /* misc temp for linking */
|
||||
- mchunkptr best = NULL;
|
||||
- size_t best_size = 0;
|
||||
-
|
||||
- bck = bin_at (av, victim_index);
|
||||
- fwd = bck->fd;
|
||||
+ /* Call malloc with worst case padding to hit alignment. */
|
||||
+ m = (char *) (_int_malloc (av, nb + alignment + MINSIZE));
|
||||
|
||||
- while (fwd != bck)
|
||||
- {
|
||||
- int extra;
|
||||
-
|
||||
- if (chunksize (fwd) < nb)
|
||||
- break;
|
||||
- extra = chunk_ok_for_memalign (fwd, alignment, nb);
|
||||
- if (extra > 0
|
||||
- && (extra <= best_size || best == NULL))
|
||||
- {
|
||||
- best = fwd;
|
||||
- best_size = extra;
|
||||
- }
|
||||
+ if (m == 0)
|
||||
+ return 0; /* propagate failure */
|
||||
|
||||
- fwd = fwd->fd;
|
||||
- }
|
||||
- victim = best;
|
||||
-
|
||||
- if (victim != NULL)
|
||||
- {
|
||||
- unlink_chunk (av, victim);
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (victim != NULL)
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /* Strategy: find a spot within that chunk that meets the alignment
|
||||
- request, and then possibly free the leading and trailing space.
|
||||
- This strategy is incredibly costly and can lead to external
|
||||
- fragmentation if header and footer chunks are unused. */
|
||||
-
|
||||
- if (victim != NULL)
|
||||
- {
|
||||
- p = victim;
|
||||
- m = chunk2mem (p);
|
||||
- set_inuse (p);
|
||||
- if (av != &main_arena)
|
||||
- set_non_main_arena (p);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- /* Call malloc with worst case padding to hit alignment. */
|
||||
-
|
||||
- m = (char *) (_int_malloc (av, nb + alignment + MINSIZE));
|
||||
-
|
||||
- if (m == 0)
|
||||
- return 0; /* propagate failure */
|
||||
-
|
||||
- p = mem2chunk (m);
|
||||
- }
|
||||
+ p = mem2chunk (m);
|
||||
|
||||
if ((((unsigned long) (m)) % alignment) != 0) /* misaligned */
|
||||
{
|
||||
diff --git a/malloc/tst-memalign-2.c b/malloc/tst-memalign-2.c
|
||||
index f229283dbf..ecd6fa249e 100644
|
||||
--- a/malloc/tst-memalign-2.c
|
||||
+++ b/malloc/tst-memalign-2.c
|
||||
@@ -86,7 +86,8 @@ do_test (void)
|
||||
TEST_VERIFY (tcache_allocs[i].ptr1 == tcache_allocs[i].ptr2);
|
||||
}
|
||||
|
||||
- /* Test for non-head tcache hits. */
|
||||
+ /* Test for non-head tcache hits. This exercises the memalign
|
||||
+ scanning code to find matching allocations. */
|
||||
for (i = 0; i < array_length (ptr); ++ i)
|
||||
{
|
||||
if (i == 4)
|
||||
@@ -113,7 +114,9 @@ do_test (void)
|
||||
free (p);
|
||||
TEST_VERIFY (count > 0);
|
||||
|
||||
- /* Large bins test. */
|
||||
+ /* Large bins test. This verifies that the over-allocated parts
|
||||
+ that memalign releases for future allocations can be reused by
|
||||
+ memalign itself at least in some cases. */
|
||||
|
||||
for (i = 0; i < LN; ++ i)
|
||||
{
|
56
glibc/keys/pgp/7273542B39962DF7B299931416792B4EA25340F8.asc
Normal file
56
glibc/keys/pgp/7273542B39962DF7B299931416792B4EA25340F8.asc
Normal file
@ -0,0 +1,56 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQINBFef5BoBEACvJ15QMMZh4stKHbz0rs78XsOdxuug37dumTx6ngrDCwZ61k7n
|
||||
HQ+uxLuoQvLSc6YJGBEfiNFbs1hvhRFNR7xJbzRYmin7kJZZ/06fH2cgTkQhN0mR
|
||||
BP8KsKKT+7SvvBL785ZfAhArWf5m5Tl0CktZ8yoG8g9dM4SgdvdSdzZUaWBVHc6T
|
||||
jdAb9YEQ1/jpyfHsQp+PWLuQZI8nZUm+I3IBDLkbbuJVQklKzpT1b8yxVSsHCyIP
|
||||
FRqDDUjPL5G4WnUVy529OzfrciBvHdxGsYYDV8FX7fv6V/S3eL6qmZbObivIbLD2
|
||||
NbeDqw6vNpr+aehEwgwNbMVuVfH1PVHJV8Qkgxg4PqPgQC7GbIhxxYroGbLJCQ41
|
||||
j25M+oqCO/XW/FUu/9x0vY5w0RsZFhlmSP5lBDcaiy3SUgp3MSTePGuxpPlLVMeP
|
||||
xKvabSS7EErLKlrAEmDgnUYYdPqGCefA+5N9Rn2JPfP7SoQEp2pHhEyM6Xg9x7TJ
|
||||
+JNuDowQCgwussmeDt2ZUeMl3s1f6/XePfTd3l8c8Yn5Fc8reRa28dFANU6oXiZf
|
||||
7/h3iQXPg81BsLMJK3aA/nyajRrNxL8dHIx7BjKX0/gxpOozlUHZHl73KhAvrBRa
|
||||
qLrr2tIPLkKrf3d7wdz4llg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
yUd6SIJ9CW7BScNtOc5QaNhawH4FBoVjz7jjomio0JihMAfdlibDJ2+Rn2UtmrJ6
|
||||
/9hAB8Hv9zSRKVKkVN74Xoy78yr3FXsR3jydvb3ZM2EsLr1leTf5v8TRArsVPhGH
|
||||
K0X4RMhtkXJvI/fliZgnC7vqCLFk+nXznVFB/LCWOOehiU2/+wtaJZTTXI5/Ogn2
|
||||
LNLkvx7ZRD8xumcjMtZZONILOjjcPa+JZIGE1uJ6LUQs3Z8Dkh5BNgLLQSgPwVxK
|
||||
qup7g6WUWGKEIp/tpRpVDZPuYvJLEJTCJUV1TWkFCXHDQDoRrYImn5y1fNcuMRJu
|
||||
W8y7oepsI16CptAIoQKkhC8ojdy3GgKgMDzyjxtRA2PxlZ+78+80HBjCv7duEjx4
|
||||
yNpfoDF/60nZ/g2ZeeworoOK8bNbAWZ5EO10NbLjIMuvS5OnTE8GS0UZEu91wrBx
|
||||
yyYHxaFWkIAZcF41dGj5FrsJNLdjoLGFqLjMFJw9mXm+eD36Cb76AfzGGeeMWuPZ
|
||||
A8OM8tYftwT2velI2tVQUeWOH2KzS+noRDSkD4D84VWBROOFhp7ww7nPz2MTDpjG
|
||||
OLWvTPdljob3Z7418Ih/6KuZSN0GDlScmZQIl52gri52hGdbIxLwTMGFqD072m5+
|
||||
hRUYRIMEBuHSKz3rNrJkKw==
|
||||
=CWf2
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
68
glibc/keys/pgp/BC7C7372637EC10C57D7AA6579C43DFBF1CF2187.asc
Normal file
68
glibc/keys/pgp/BC7C7372637EC10C57D7AA6579C43DFBF1CF2187.asc
Normal file
@ -0,0 +1,68 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQENBFMAZNMBCACeatEKl6YY9iEVxzS64bPbvJsA1mLE2XFWmKXyYzm58dFqPMa0
|
||||
OQQTKCxjFCOrc+LD2KtmypttcahKnk5Lk1lNU/lV2hCuR7jJ37sL+/TFQuMMgsLP
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pbJOdrND0TDWXhyOHLGsFC6WuE
|
||||
MtQudfSKMOhKFqySN0xZQUKlb11n2MT479gqlw7o/UPDy1gDtssG+zG9DD72Xkq3
|
||||
lbzzthM/e7ldcB8dMRoVLl9e1XZLoOfL/RAV/z9UxHezRjjYDV69EPxzKsgj+Id3
|
||||
AzmY9XeSqUeDWX17z6ARV0mh4uGePEriEmPCuQENBFMAZNMBCAChC0iEpSfa897U
|
||||
gTzZKcqsCD5+P/2QbhDSUHyFiFmDPa+9rAUR2YIopbDeyu4OhGu7y1FYL+fliJxO
|
||||
D1hUGqlEmzLm047IZ2iACHklNK7JcEUartgfR5kvJmqwflGHUPjLD1RCJ6wfLq6B
|
||||
X/CYe4ftjqrNjClDLGsqBckJFbcIdxyPwDE5Jiuorp9wIpDivifVi0MdkKn/ny42
|
||||
Of2SI26MG3fBitweIeJFD23lCOUzYOsXClcsVTzMvB2s32g8JVB34dOytFBVrWhb
|
||||
sPb97ZWonjkyx9A9HAV8mEwKoLOwuunMrccPkK+v/rh2vDDERA0MExBMMInJN4dI
|
||||
fryIQrFdABEBAAGJAR8EGAECAAkCGwwFAlTqs98ACgkQecQ9+/HPIYf1Mwf9ENd6
|
||||
C/2kvJJvbFzmvDNa6EOvTVKaqTBDhgVjuZ2ivMGdkCoeA9OQ3zWu8k+RYDyyPmuJ
|
||||
HToFm1tn4hP8DGDjIr46Bb3jnZcz6bHsOp9quf3L6KbKa4ghiVqM05ML9Xb/YH0y
|
||||
ge3QybfiAnWm6e2qIbzYucXmYDOBsQojta369CZ+zQEdy+baULFQ+Hg02vY4NKqv
|
||||
xIhfri0B/Ng+m7MbUv163u2/7Eyit4xOrLYbouuMOxd1+TNasJPFwrKgjQNWdnPs
|
||||
1pCxh+GXgf0a8WqbtB9P0wIQQbWw6OuuRmkW9zUisxuKyUo10hEHOK52v2O/7N3P
|
||||
bgdMo3cl19PJpx81Tg==
|
||||
=RgMn
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
@ -1,145 +1,28 @@
|
||||
From e47de5cb2d4dbecb58f569ed241e8e95c568f03c Mon Sep 17 00:00:00 2001
|
||||
From: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri, 29 Apr 2022 16:37:51 +0200
|
||||
Subject: [PATCH] Do not use --hash-style=both for building glibc shared
|
||||
objects
|
||||
From 31915e55f9c34f6137ab1c5ac002375a2d5d4589 Mon Sep 17 00:00:00 2001
|
||||
From: Frederik Schwan <frederik.schwan@linux.com>
|
||||
Date: Fri, 4 Aug 2023 15:19:57 +0200
|
||||
Subject: [PATCH] force --hash-style=both to keep compatibility with old niche
|
||||
software
|
||||
|
||||
The comment indicates that --hash-style=both was used to maintain
|
||||
compatibility with static dlopen, but we had many internal ABI
|
||||
changes since then, so this compatiblity does not add value anymore.
|
||||
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
---
|
||||
Makeconfig | 9 +++++++++
|
||||
Makerules | 7 +++++++
|
||||
config.make.in | 1 +
|
||||
configure | 28 ++++++++++++++++++++++++++++
|
||||
configure.ac | 16 ++++++++++++++++
|
||||
5 files changed, 61 insertions(+)
|
||||
Makeconfig | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git b/Makeconfig a/Makeconfig
|
||||
index 760f14e92f..0aa5fb0099 100644
|
||||
--- b/Makeconfig
|
||||
+++ a/Makeconfig
|
||||
@@ -362,6 +362,15 @@ relro-LDFLAGS = -Wl,-z,relro
|
||||
diff --git a/Makeconfig b/Makeconfig
|
||||
index 77d7fd14df..2ae67c4beb 100644
|
||||
--- a/Makeconfig
|
||||
+++ b/Makeconfig
|
||||
@@ -378,6 +378,10 @@ relro-LDFLAGS = -Wl,-z,relro
|
||||
LDFLAGS.so += $(relro-LDFLAGS)
|
||||
LDFLAGS-rtld += $(relro-LDFLAGS)
|
||||
|
||||
+ifeq (yes,$(have-hash-style))
|
||||
+# For the time being we unconditionally use 'both'. At some time we
|
||||
+# should declare statically linked code as 'out of luck' and compile
|
||||
+# with --hash-style=gnu only.
|
||||
+hashstyle-LDFLAGS = -Wl,--hash-style=both
|
||||
+LDFLAGS.so += $(hashstyle-LDFLAGS)
|
||||
+LDFLAGS-rtld += $(hashstyle-LDFLAGS)
|
||||
+endif
|
||||
+
|
||||
ifeq (no,$(build-pie-default))
|
||||
pie-default = $(no-pie-ccflag)
|
||||
else # build-pie-default
|
||||
diff --git b/Makerules a/Makerules
|
||||
index 354528b8c7..428464f092 100644
|
||||
--- b/Makerules
|
||||
+++ a/Makerules
|
||||
@@ -557,6 +557,13 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
|
||||
-Wl,--verbose 2>/dev/null | \
|
||||
sed > $@T \
|
||||
-e '/^=========/,/^=========/!d;/^=========/d' \
|
||||
+ $(if $(filter yes,$(have-hash-style)), \
|
||||
+ -e 's/^.*\.gnu\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \
|
||||
+ -e '/^[ ]*\.hash[ ]*:.*$$/{h;d;}' \
|
||||
+ -e '/DATA_SEGMENT_ALIGN/{H;g}' \
|
||||
+ , \
|
||||
+ -e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \
|
||||
+ ) \
|
||||
-e 's/^.*\*(\.dynbss).*$$/& \
|
||||
PROVIDE(__start___libc_freeres_ptrs = .); \
|
||||
*(__libc_freeres_ptrs) \
|
||||
diff --git b/config.make.in a/config.make.in
|
||||
index fff4c78dd0..bf728c71c0 100644
|
||||
--- b/config.make.in
|
||||
+++ a/config.make.in
|
||||
@@ -70,6 +70,7 @@ have-libcap = @have_libcap@
|
||||
have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
|
||||
fno-unit-at-a-time = @fno_unit_at_a_time@
|
||||
bind-now = @bindnow@
|
||||
+have-hash-style = @libc_cv_hashstyle@
|
||||
use-default-link = @use_default_link@
|
||||
have-cxx-thread_local = @libc_cv_cxx_thread_local@
|
||||
have-loop-to-function = @libc_cv_cc_loop_to_function@
|
||||
diff --git b/configure a/configure
|
||||
index 716dc041b6..5a730dc5fc 100755
|
||||
--- b/configure
|
||||
+++ a/configure
|
||||
@@ -622,6 +622,7 @@ libc_cv_cc_nofma
|
||||
libc_cv_mtls_dialect_gnu2
|
||||
fno_unit_at_a_time
|
||||
libc_cv_has_glob_dat
|
||||
+libc_cv_hashstyle
|
||||
libc_cv_fpie
|
||||
libc_cv_z_execstack
|
||||
ASFLAGS_config
|
||||
@@ -6193,6 +6194,33 @@ $as_echo "$libc_cv_fpie" >&6; }
|
||||
|
||||
|
||||
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --hash-style option" >&5
|
||||
+$as_echo_n "checking for --hash-style option... " >&6; }
|
||||
+if ${libc_cv_hashstyle+:} false; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ cat > conftest.c <<EOF
|
||||
+int _start (void) { return 42; }
|
||||
+EOF
|
||||
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
|
||||
+ -fPIC -shared -o conftest.so conftest.c
|
||||
+ -Wl,--hash-style=both -nostdlib 1>&5'
|
||||
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||
+ (eval $ac_try) 2>&5
|
||||
+ ac_status=$?
|
||||
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
+ test $ac_status = 0; }; }
|
||||
+then
|
||||
+ libc_cv_hashstyle=yes
|
||||
+else
|
||||
+ libc_cv_hashstyle=no
|
||||
+fi
|
||||
+rm -f conftest*
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_hashstyle" >&5
|
||||
+$as_echo "$libc_cv_hashstyle" >&6; }
|
||||
+
|
||||
+
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_DAT reloc" >&5
|
||||
$as_echo_n "checking for GLOB_DAT reloc... " >&6; }
|
||||
if ${libc_cv_has_glob_dat+:} false; then :
|
||||
diff --git b/configure.ac a/configure.ac
|
||||
index d08ad4d64e..a045f6608e 100644
|
||||
--- b/configure.ac
|
||||
+++ a/configure.ac
|
||||
@@ -1360,6 +1360,22 @@ LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
|
||||
|
||||
AC_SUBST(libc_cv_fpie)
|
||||
|
||||
+AC_CACHE_CHECK(for --hash-style option,
|
||||
+ libc_cv_hashstyle, [dnl
|
||||
+cat > conftest.c <<EOF
|
||||
+int _start (void) { return 42; }
|
||||
+EOF
|
||||
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
|
||||
+ -fPIC -shared -o conftest.so conftest.c
|
||||
+ -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
|
||||
+then
|
||||
+ libc_cv_hashstyle=yes
|
||||
+else
|
||||
+ libc_cv_hashstyle=no
|
||||
+fi
|
||||
+rm -f conftest*])
|
||||
+AC_SUBST(libc_cv_hashstyle)
|
||||
+
|
||||
AC_CACHE_CHECK(for GLOB_DAT reloc,
|
||||
libc_cv_has_glob_dat, [dnl
|
||||
cat > conftest.c <<EOF
|
||||
# Linker options to enable and disable DT_RELR.
|
||||
ifeq ($(have-dt-relr),yes)
|
||||
dt-relr-ldflag = -Wl,-z,pack-relative-relocs
|
||||
--
|
||||
2.37.1
|
||||
2.41.0
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user