From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52173 invoked by alias); 27 Mar 2015 18:11:36 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 51944 invoked by uid 55); 27 Mar 2015 18:11:33 -0000 From: "hjl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/65248] Copy relocation against protected symbol doesn't work Date: Fri, 27 Mar 2015 18:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-03/txt/msg03232.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 --- Comment #5 from hjl at gcc dot gnu.org --- Author: hjl Date: Fri Mar 27 18:11:00 2015 New Revision: 221742 URL: https://gcc.gnu.org/viewcvs?rev=221742&root=gcc&view=rev Log: Add default_binds_local_p_2 and use it for x86 Protected data symbol means that it can't be pre-emptied. It doesn't mean its address won't be external. This is true for pointer to protected function. With copy relocation, address of protected data defined in the shared library may also be external. We only know that for sure at run-time. TARGET_BINDS_LOCAL_P should return false on protected data symbol. gcc/ PR target/65248 * output.h (default_binds_local_p_2): New. * varasm.c (default_binds_local_p_2): Renamed to ... (default_binds_local_p_3): This. Don't return true on protected data symbol if protected data may be external. (default_binds_local_p): Use default_binds_local_p_3. (default_binds_local_p_1): Likewise. (default_binds_local_p_2): New. * config/i386/i386.c (TARGET_BINDS_LOCAL_P): Set to default_binds_local_p_2 if TARGET_MACHO is undefined. gcc/testsuite/ PR target/65248 * gcc.target/i386/pr65248-1.c: New file. * gcc.target/i386/pr65248-2.c: Likewise. * gcc.target/i386/pr65248-3.c: Likewise. * gcc.target/i386/pr65248-4.c: Likewise. Added: trunk/gcc/testsuite/gcc.target/i386/pr65248-1.c trunk/gcc/testsuite/gcc.target/i386/pr65248-2.c trunk/gcc/testsuite/gcc.target/i386/pr65248-3.c trunk/gcc/testsuite/gcc.target/i386/pr65248-4.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c trunk/gcc/output.h trunk/gcc/testsuite/ChangeLog trunk/gcc/varasm.c