From patchwork Sun Jan 6 20:32:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 209800 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]) by ozlabs.org (Postfix) with SMTP id C6BB82C0085 for ; Mon, 7 Jan 2013 07:32:36 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1358109157; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:Date:Message-ID:Subject:From:To: Cc:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=pwcWsHq CcF5INQbPHgG9Sfs9byc=; b=Nri+xbV6LPEmll6/+VqNEH0std8VHUuuYP1jLlo n/lQ1aCuhySHU2Tliay0eh2TCch/f22RN1F1v4YaAcMawhyOMfRxw5v+3/9xf6O8 PMk8d12npuBixEdWoOW7qy/J34LnB2z1FPzwShHdV3E19UnfkfGGNTIZuM6jBvMZ 7Mok= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:Date:Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=log4SAaLmC4VpVeaDoYDgdP8otvEJOCd3D//ER/h2+cjZwPsYw/u89KHoy0cGp uAXc863zZS0oJSF6weo7IbpdAx6thUk5TDvePfSKYQL1BgoTPspqGtSX2cHmAfke dVNuITXJCFcGtDQzR3mEpAvVZrWSnJyiFmIjFOpBz9S3A=; Received: (qmail 24192 invoked by alias); 6 Jan 2013 20:32:32 -0000 Received: (qmail 24184 invoked by uid 22791); 6 Jan 2013 20:32:31 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FB_GET_MEDS, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-oa0-f44.google.com (HELO mail-oa0-f44.google.com) (209.85.219.44) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 06 Jan 2013 20:32:23 +0000 Received: by mail-oa0-f44.google.com with SMTP id n5so16993475oag.17 for ; Sun, 06 Jan 2013 12:32:23 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.95.133 with SMTP id dk5mr43655538obb.14.1357504343101; Sun, 06 Jan 2013 12:32:23 -0800 (PST) Received: by 10.182.153.201 with HTTP; Sun, 6 Jan 2013 12:32:22 -0800 (PST) Date: Sun, 6 Jan 2013 21:32:22 +0100 Message-ID: Subject: Re: [PATCH] Adding target rdos to GCC From: Uros Bizjak To: gcc-patches@gcc.gnu.org Cc: Leif Ekblad , "H.J. Lu" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hello! > Updated patches with the suggestions below, except that the initial value is 0 > (which is not meaningful). I also added a setting in rdos target file to use r15 > for PIC instead of rbx. *** gcc-4.8-20121230/gcc/config/i386/i386.c Thu Dec 27 02:58:06 2012 --- gcc-work/gcc/config/i386/i386.c Sun Jan 6 14:10:34 2013 + if (ix86_section_threshold == 0) + ix86_section_threshold = DEFAULT_SECTION_THRESHOLD; Please see attached patch on how to initialize an option. *** gcc-4.8-20121230/gcc/config/i386/i386.h Wed Dec 19 17:04:12 2012 --- gcc-work/gcc/config/i386/i386.h Sun Jan 6 13:24:26 2013 + #define TARGET_MEDIUM_PIC 0 You should just use TARGET_RDOS here (also, please see attached patch). + /* Default threshold for putting data in large sections with x86-64 + medium memory model */ + #define DEFAULT_SECTION_THRESHOLD 65536 Do not put this define in the middle of i386.h section that deals with alignment... *** gcc-4.8-20121230/gcc/config/i386/rdos.h Thu Jan 1 01:00:00 1970 --- gcc-work/gcc/config/i386/rdos.h Sun Jan 6 13:20:12 2013 + #undef REAL_PIC_OFFSET_TABLE_REGNUM + #define REAL_PIC_OFFSET_TABLE_REGNUM R15_REG Is this header also used for 32bit target? You should not use REX registers for 32bit targets. + #undef TARGET_MEDIUM_PIC + #define TARGET_MEDIUM_PIC 1 TARGET_RDOS + #define DEFAULT_SECTION_THRESHOLD 0x10 No hex numbers here. Also, you will need to #undef this first to override the default in i386.h. *** gcc-4.8-20121230/gcc/config.gcc Thu Nov 22 00:33:40 2012 --- gcc-work/gcc/config.gcc Fri Jan 4 21:08:46 2013 + i[34567]86-*-rdos*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h" + ;; You forgot to include i386/rdos.h here (other headers too?). It is needed at least for TARGET_EXECUTABLE_SUFFIX define. Uros. Index: i386.c =================================================================== --- i386.c (revision 194945) +++ i386.c (working copy) @@ -3239,6 +3239,8 @@ DLL, and is essentially just as efficient as direct addressing. */ if (TARGET_64BIT && DEFAULT_ABI == MS_ABI) ix86_cmodel = CM_SMALL_PIC, flag_pic = 1; + else if (TARGET_64BIT && TARGET_RDOS) + ix86_cmodel = CM_MEDIUM_PIC, flag_pic = 1; else if (TARGET_64BIT) ix86_cmodel = flag_pic ? CM_SMALL_PIC : CM_SMALL; else Index: i386.h =================================================================== --- i386.h (revision 194945) +++ i386.h (working copy) @@ -519,6 +519,9 @@ #define MACHOPIC_INDIRECT 0 #define MACHOPIC_PURE 0 +/* For the RDOS */ +#define TARGET_RDOS 0 + /* For the Windows 64-bit ABI. */ #define TARGET_64BIT_MS_ABI (TARGET_64BIT && ix86_cfun_abi () == MS_ABI) @@ -2081,6 +2084,10 @@ asm (SECTION_OP "\n\t" \ "call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n" \ TEXT_SECTION_ASM_OP); + +/* Default threshold for putting data in large sections + with x86-64 medium memory model */ +#define DEFAULT_LARGE_SECTION_THRESHOLD 65536 /* Which processor to tune code generation for. */ Index: i386.opt =================================================================== --- i386.opt (revision 194945) +++ i386.opt (working copy) @@ -141,7 +141,7 @@ Branches are this expensive (1-5, arbitrary units) mlarge-data-threshold= -Target RejectNegative Joined UInteger Var(ix86_section_threshold) Init(65536) +Target RejectNegative Joined UInteger Var(ix86_section_threshold) Init(DEFAULT_LARGE_SECTION_THRESHOLD) Data greater than given threshold will go into .ldata section in x86-64 medium model mcmodel=