From patchwork Mon Jun 13 12:20:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 634601 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rSsLf0G38z9sp7 for ; Mon, 13 Jun 2016 22:20:41 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=Y/do2Cox; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; q=dns; s=default; b= Xx2rphIkWbQO7GkOq6YUCfQySsRsRl1o0YfQZFBmt9h0StJV9UrurZjnedfesTa3 yBIIWyEXWL73QkPtR0TP4JUTwn6N5gfbQ3suE+I3FwKRMEcVOdohzQ573um44z8H U1FVpGjbgq3Nnl8BSoO59gYniYTvFtqnnD3ubTgUWD8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; s=default; bh=Fe3wDj 6yzmeYwsxkgBIjXm9Reds=; b=Y/do2CoxdniPvR3eglxiw7nWWgLCgMK9SXFr3a u0Q2QCoJYvjSJNYAg7EQEP7dWxW509FwRP/ACUu64LMeG5fRShtybJcD0Y929eRo oWIAJrZLOUSYAlmy8G6jiVlhcSZggo4WRo/iIvZP9KCpx/VAJ4x5I885v8K5h3jN KF1yQ= Received: (qmail 2130 invoked by alias); 13 Jun 2016 12:20:35 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 2116 invoked by uid 89); 13 Jun 2016 12:20:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Date: Mon, 13 Jun 2016 14:20:31 +0200 To: libc-alpha@sourceware.org Subject: [PATCH] Revert __malloc_initialize_hook symbol poisoning User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20160613122031.80ABE4091079D@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) It turns out the Emacs-internal malloc implementation uses __malloc_* symbols. If glibc poisons them in , Emacs will no longer compile. 2016-06-13 Florian Weimer Revert symbol poisoning of __malloc_initialize_hook. * include/stdc-predef.h (__malloc_initialize_hook): Remove poisoning. * malloc/Makefile: Remove un-poisoning. * malloc/arena.c (ptmalloc_init): Use __malloc_initialize_hook instead of old__malloc_initialize_hook. * malloc/malloc-hooks.h: Likewise. * malloc/malloc.c: Likewise. * malloc/mcheck-init.c: Likewise. diff --git a/include/stdc-predef.h b/include/stdc-predef.h index 52cf8d1..f9f7f73 100644 --- a/include/stdc-predef.h +++ b/include/stdc-predef.h @@ -57,11 +57,4 @@ /* We do not support C11 . */ #define __STDC_NO_THREADS__ 1 -/* Remove symbols from the API which can be interposed. */ -#if defined (__GNUC__) -# if __GNUC__ >= 4 -# pragma GCC poison __malloc_initialize_hook -# endif /* __GNUC__ >= 4 */ -#endif /* __GNUC__ */ - #endif diff --git a/malloc/Makefile b/malloc/Makefile index 91eb17d..fa1730e 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -115,20 +115,6 @@ endif include ../Rules -# Support references to removed APIs. We use #pragma GCC poison in -# to make it difficult to reference them. For select -# source files, we work around this poisoning by defining a macro on -# the command line (which is processed before and can -# therefore use tokens poisoned later). -poisoned_apis = \ - __malloc_initialize_hook \ - -unpoisoned_api_defines := \ - $(foreach sym,$(poisoned_apis), \ - $(patsubst %,-Dold%, $(sym))=$(sym)) -CPPFLAGS-malloc.c = $(unpoisoned_api_defines) -CPPFLAGS-mcheck-init.c = $(unpoisoned_api_defines) - CFLAGS-mcheck-init.c = $(PIC-ccflag) CFLAGS-obstack.c = $(uses-callbacks) diff --git a/malloc/arena.c b/malloc/arena.c index 64a118c..ed5a4d5 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -341,7 +341,7 @@ ptmalloc_init (void) __malloc_check_init (); } #if HAVE_MALLOC_INIT_HOOK - void (*hook) (void) = atomic_forced_read (old__malloc_initialize_hook); + void (*hook) (void) = atomic_forced_read (__malloc_initialize_hook); if (hook != NULL) (*hook)(); #endif diff --git a/malloc/malloc-hooks.h b/malloc/malloc-hooks.h index 3be391b..c7aa8b2 100644 --- a/malloc/malloc-hooks.h +++ b/malloc/malloc-hooks.h @@ -19,9 +19,6 @@ #ifndef _MALLOC_HOOKS_H #define _MALLOC_HOOKS_H -/* These hooks are no longer part of the public API and are poisoned - in . Their names here reflect the command-line - mapping which is used inside glibc to get past the poisoning. */ -void (*old__malloc_initialize_hook) (void); +void (*__malloc_initialize_hook) (void); #endif /* _MALLOC_HOOKS_H */ diff --git a/malloc/malloc.c b/malloc/malloc.c index 21a912a..1f5f166 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1851,9 +1851,9 @@ static void *memalign_hook_ini (size_t alignment, size_t sz, const void *caller) __THROW; #if HAVE_MALLOC_INIT_HOOK -void weak_variable (*old__malloc_initialize_hook) (void) = NULL; -compat_symbol (libc, old__malloc_initialize_hook, - old__malloc_initialize_hook, GLIBC_2_0); +void weak_variable (*__malloc_initialize_hook) (void) = NULL; +compat_symbol (libc, __malloc_initialize_hook, + __malloc_initialize_hook, GLIBC_2_0); #endif void weak_variable (*__free_hook) (void *__ptr, diff --git a/malloc/mcheck-init.c b/malloc/mcheck-init.c index 3218bb0..8d63dd3 100644 --- a/malloc/mcheck-init.c +++ b/malloc/mcheck-init.c @@ -27,4 +27,4 @@ turn_on_mcheck (void) mcheck (NULL); } -void (*old__malloc_initialize_hook) (void) = turn_on_mcheck; +void (*__malloc_initialize_hook) (void) = turn_on_mcheck;