From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4545 invoked by alias); 14 Apr 2005 22:38:14 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 4034 invoked from network); 14 Apr 2005 22:38:01 -0000 Received: from unknown (HELO mailapp.tensilica.com) (65.205.227.29) by sourceware.org with SMTP; 14 Apr 2005 22:38:01 -0000 Received: from localhost ([127.0.0.1] ident=amavis) by mailapp.tensilica.com with esmtp (Exim 4.34) id 1DMCyF-0004Hx-9p; Thu, 14 Apr 2005 15:37:59 -0700 Received: from mailapp.tensilica.com ([127.0.0.1]) by localhost (mailapp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 16460-01; Thu, 14 Apr 2005 15:37:59 -0700 (PDT) Received: from heron.hq.tensilica.com ([192.168.11.123]) by mailapp.tensilica.com with esmtp (Exim 4.34) id 1DMCyE-0004Hr-V0; Thu, 14 Apr 2005 15:37:58 -0700 Received: from [192.168.11.123] (heron.hq.tensilica.com [192.168.11.123]) by heron.hq.tensilica.com (8.13.1/8.13.1) with ESMTP id j3EMbvsG025876; Thu, 14 Apr 2005 15:37:58 -0700 Message-ID: <425EF0C5.7050607@tensilica.com> Date: Thu, 14 Apr 2005 22:38:00 -0000 From: Bob Wilson Organization: Tensilica, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 MIME-Version: 1.0 To: "H. J. Lu" CC: binutils@sources.redhat.com Subject: Re: PATCH: Support 64bit BFD and 64bit host for xtensa References: <20050409204835.GA1319@lucon.org> <20050410163925.GB28734@lucon.org> <425AAC0A.6060403@tensilica.com> <20050411174033.GB17706@lucon.org> In-Reply-To: <20050411174033.GB17706@lucon.org> Content-Type: multipart/mixed; boundary="------------020909040408030009060009" X-SW-Source: 2005-04/txt/msg00397.txt.bz2 This is a multi-part message in MIME format. --------------020909040408030009060009 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1177 H. J. Lu wrote: > I will leave xtensa to you. You can pick my xtensa patch if you want. OK. Here's a patch that combines your casts for 64-bit builds with a simple solution to the pointers-stored-as-ints problem. I would really love to replace all the code involved in the latter problem, but it will be a while before I can get to it, and I didn't want to leave the 64-bit builds broken in the meantime. I just changed the code to use pointer fields in the Xtensa-specific tc_frag_data structure. I tested this with --enable-64-bit-bfd builds on both x86_64-unknown-linux-gnu and i686-pc-linux-gnu hosts. Committed on the mainline and 2.16 branch. 2005-04-14 Bob Wilson H.J. Lu * config/tc-xtensa.h (struct xtensa_frag_type): Add lit_frchain field. * config/tc-xtensa.c (xg_translate_sysreg_op, xtensa_translate_old_userregs_ops, xtensa_find_unaligned_branch_targets, xtensa_find_unaligned_loops, xtensa_fix_close_loop_end_frags, relax_frag_add_nop): Support 64-bit host. (xtensa_mark_literal_pool_location, xtensa_move_literals): Use tc_frag_data lit_frchain and lit_seg fields instead of fr_var. --------------020909040408030009060009 Content-Type: text/x-patch; name="gas64.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gas64.diff" Content-length: 4709 Index: config/tc-xtensa.c =================================================================== RCS file: /cvs/src/src/gas/config/tc-xtensa.c,v retrieving revision 1.31 diff -u -p -r1.31 tc-xtensa.c --- config/tc-xtensa.c 11 Apr 2005 22:45:37 -0000 1.31 +++ config/tc-xtensa.c 14 Apr 2005 22:01:57 -0000 @@ -2247,7 +2247,7 @@ xg_translate_sysreg_op (char **popname, if (sr == XTENSA_UNDEFINED) { as_bad (_("invalid register number (%ld) for '%s' instruction"), - val, opname); + (long) val, opname); return -1; } } @@ -2316,7 +2316,7 @@ xtensa_translate_old_userreg_ops (char * if (sr == XTENSA_UNDEFINED) { as_bad (_("invalid register number (%ld) for '%s'"), - val, opname); + (long) val, opname); return -1; } } @@ -4645,15 +4645,15 @@ xtensa_mark_literal_pool_location (void) frag_align (2, 0, 0); record_alignment (now_seg, 2); - /* We stash info in the fr_var of these frags - so we can later move the literal's fixes into this - frchain's fix list. We can use fr_var because fr_var's - interpretation depends solely on the fr_type and subtype. */ + /* We stash info in these frags so we can later move the literal's + fixes into this frchain's fix list. */ pool_location = frag_now; - frag_variant (rs_machine_dependent, 0, (int) frchain_now, + frag_now->tc_frag_data.lit_frchain = frchain_now; + frag_variant (rs_machine_dependent, 0, 0, RELAX_LITERAL_POOL_BEGIN, NULL, 0, NULL); xtensa_set_frag_assembly_state (frag_now); - frag_variant (rs_machine_dependent, 0, (int) now_seg, + frag_now->tc_frag_data.lit_seg = now_seg; + frag_variant (rs_machine_dependent, 0, 0, RELAX_LITERAL_POOL_END, NULL, 0, NULL); xtensa_set_frag_assembly_state (frag_now); @@ -4882,7 +4882,7 @@ xtensa_find_unaligned_branch_targets (bf if (frag_addr + op_size > branch_align) as_warn_where (frag->fr_file, frag->fr_line, _("unaligned branch target: %d bytes at 0x%lx"), - op_size, frag->fr_address); + op_size, (long) frag->fr_address); } frag = frag->fr_next; } @@ -4921,7 +4921,7 @@ xtensa_find_unaligned_loops (bfd *abfd A if (frag_addr + op_size > xtensa_fetch_width) as_warn_where (frag->fr_file, frag->fr_line, _("unaligned loop: %d bytes at 0x%lx"), - op_size, frag->fr_address); + op_size, (long) frag->fr_address); } frag = frag->fr_next; } @@ -7462,7 +7462,7 @@ xtensa_fix_close_loop_end_frags (void) if (fragP->fr_var < length) as_fatal (_("fr_var %lu < length %d"), - fragP->fr_var, length); + (long) fragP->fr_var, length); else { assemble_nop (length, @@ -8410,7 +8410,7 @@ relax_frag_add_nop (fragS *fragP) if (fragP->fr_var < length) { - as_fatal (_("fr_var (%ld) < length (%d)"), fragP->fr_var, length); + as_fatal (_("fr_var (%ld) < length (%d)"), (long) fragP->fr_var, length); return 0; } @@ -9869,17 +9869,15 @@ xtensa_move_literals (void) { literal_pool = search_frag->tc_frag_data.literal_frag; assert (literal_pool->fr_subtype == RELAX_LITERAL_POOL_BEGIN); - /* Note that we set this fr_var to be a fix - chain when we created the literal pool location - as RELAX_LITERAL_POOL_BEGIN. */ - frchain_to = (frchainS *) literal_pool->fr_var; + frchain_to = literal_pool->tc_frag_data.lit_frchain; + assert (frchain_to); } insert_after = literal_pool; while (insert_after->fr_next->fr_subtype != RELAX_LITERAL_POOL_END) insert_after = insert_after->fr_next; - dest_seg = (segT) insert_after->fr_next->fr_var; + dest_seg = insert_after->fr_next->tc_frag_data.lit_seg; *frag_splice = next_frag; search_frag->fr_next = insert_after->fr_next; Index: config/tc-xtensa.h =================================================================== RCS file: /cvs/src/src/gas/config/tc-xtensa.h,v retrieving revision 1.10 diff -u -p -r1.10 tc-xtensa.h --- config/tc-xtensa.h 26 Mar 2005 00:21:01 -0000 1.10 +++ config/tc-xtensa.h 14 Apr 2005 22:01:57 -0000 @@ -227,9 +227,13 @@ struct xtensa_frag_type fragS *literal_frag; /* The destination segment for literal frags. (Note that this is only - valid after xtensa_move_literals. */ + valid after xtensa_move_literals.) This field is also used for + LITERAL_POOL_END frags. */ segT lit_seg; + /* Frag chain for LITERAL_POOL_BEGIN frags. */ + struct frchain *lit_frchain; + /* For the relaxation scheme, some literal fragments can have their expansions modified by an instruction that relaxes. */ int text_expansion[MAX_SLOTS]; --------------020909040408030009060009--