From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12olkn2088.outbound.protection.outlook.com [40.92.21.88]) by sourceware.org (Postfix) with ESMTPS id 60B87395340E for ; Thu, 7 Jan 2021 06:26:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 60B87395340E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=maskray.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=i@maskray.me ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h+8qhaUSaKtzgHUaX+UxWfOxaOmx1Yn+Ojdd9i1VmUYeXKPNnbAmG/VrymrGJb2bYLk6I0ma7cSw03Z/5JfBP0ux6k2z+jl3ToFIDHfE4OJPs/u2pMdpPYQSFE7rvPxgE1tfs+lUbLq8g4b1PkZqwr8yf9HX/b4mzqRtXuVlUSEwilZB2NFr9quxUr0zV7DCn5un/at7pnKBD6+mpkPdJS44VGCLlq8hm4/p3cEnDPrUuZ/fFsPLJvGSTy8Lf07E914AIo6x8ON5H4jmmy/qE6RC5pZVD5bol5Ov744jM8OhbOwHhMSkFjZdNFHhO/ye1aC6oNjWlWz8DMsdxRj/sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bdqq8rpTC1GaECnHDuc+20kmVIIKfg+jDr0NMTIi9hA=; b=el3BnaWspEAjFIrFLNzKHHipVebZoPy8a8bnMGE3L3HKMsemuWGqj55vsKsmAWlosZjIoEaoYyMy0pGJQZ4YavS1pC6lfDrCVcGamiSpabYj5s5xwOCblQqQg0O71fwJqXcE5fvvO/rlLHkzNGh3eA8RuYyHgZB4cHqFOBTbttsPcAPKeI6d0ROZHdMMKv4uJxiIqvEP1Zbp4R3/qSM7qS9vZQqgtSeHwuMhvlwmh7eQzx/ZG4e90PrEd3v9JXGAURejqaIT9z61TmotWRMp7+n+/lyn88B47EtmjPHvhrHXA80Y5gD2/MJdMeDwfeTvN6JkGQbVrbC0q6zIvGXcvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from BN8NAM12FT030.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::4b) by BN8NAM12HT159.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.2; Thu, 7 Jan 2021 06:26:38 +0000 Received: from MWHPR1201MB0110.namprd12.prod.outlook.com (2a01:111:e400:fc66::40) by BN8NAM12FT030.mail.protection.outlook.com (2a01:111:e400:fc66::334) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.2 via Frontend Transport; Thu, 7 Jan 2021 06:26:38 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:6B5D6B581CA625CC7E3DD5B0B144D04C0D63ED542D497D2C0044AA880DA2CE1E; UpperCasedChecksum:4694F6C71A454ABEF082077CB01064A3307CAF3E75D7664C72E02433B22FDCDB; SizeAsReceived:9250; Count:50 Received: from MWHPR1201MB0110.namprd12.prod.outlook.com ([fe80::d413:5a54:24aa:906d]) by MWHPR1201MB0110.namprd12.prod.outlook.com ([fe80::d413:5a54:24aa:906d%8]) with mapi id 15.20.3742.006; Thu, 7 Jan 2021 06:26:37 +0000 X-Gm-Message-State: AOAM532JKYW/om7TJkEHtjYRYXGXl0giiueRuU7ZpPK9Qxyc4LsO5eNH XskW32vw5NoOrj/bnMpJpj4CNiqI6nip2fsco58= X-Google-Smtp-Source: ABdhPJzypSzX7FNzXjdXjRBbk2yq+w5jivRTyNsJteA+VY1SV1gsUKjojoToXMp7lzObherM1XR2ab8Z19d9tHQSzB4= X-Received: by 2002:aed:2183:: with SMTP id l3mr7099832qtc.75.1610000794265; Wed, 06 Jan 2021 22:26:34 -0800 (PST) References: <20201217071017.xylpud62keerb54u@gmail.com> <87h7o81t3v.fsf@mid.deneb.enyo.de> In-Reply-To: From: Fangrui Song Date: Wed, 6 Jan 2021 22:26:23 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Add -fdirect-access-external-data To: GCC Development Cc: "H.J. Lu" , Florian Weimer Content-Type: text/plain; charset="UTF-8" X-TMN: [tRHZgyNoNr/gpRl7sePCEe++xw3upkP0] X-ClientProxiedBy: BL1PR13CA0458.namprd13.prod.outlook.com (2603:10b6:208:2c4::13) To MWHPR1201MB0110.namprd12.prod.outlook.com (2603:10b6:301:56::8) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mail-qt1-f171.google.com (209.85.160.171) by BL1PR13CA0458.namprd13.prod.outlook.com (2603:10b6:208:2c4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.4 via Frontend Transport; Thu, 7 Jan 2021 06:26:36 +0000 Received: by mail-qt1-f171.google.com with SMTP id b9so3692856qtr.2 for ; Wed, 06 Jan 2021 22:26:36 -0800 (PST) X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 537b0aca-14c4-4c0c-5460-08d8b2d53011 X-MS-TrafficTypeDiagnostic: BN8NAM12HT159: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m/jw/UyWu/s6NidoBoOUvS76e3nB3V1diNgzbOuBMu4Gt5gTXTq/6LwwRkoHhNFznBVr3SlCiZIw3b0PDZjOIyksvVtihrgJ1vjAAgL8aJoxThLF2gr6/o5dKMidtfdGlNmsms8mBYSHQrHg76sx32y+odcyx8NT7cnEHq4FV6laLZd6kBzZ2xNGHEED9i8OW2iPP6fsb45BCGyAH6SI5YqQRle1p6zStUa6fGrMOb01CcDuQeKZphu+PAjsBMpfYkNrzj1uZcQTbI09XvSPbJsdgx8eTPPCvvpV0ZFVnu4= X-MS-Exchange-AntiSpam-MessageData: qeAb9a8usYK3O2+oF4qmdd6YXk0KBfxgCzaTNARH4S6CvwXubs6sgkpM1DAj8vH0NLmPnDMxnK7Pfg2YgLB0vsUBqYCilvuaMjmcUANbUqWgdWglNWkMc1ZEsQjpcL6xZ/RLd569ERjlW76t+JWsBw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2021 06:26:37.6345 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-Network-Message-Id: 537b0aca-14c4-4c0c-5460-08d8b2d53011 X-MS-Exchange-CrossTenant-AuthSource: BN8NAM12FT030.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM12HT159 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_INFOUSMEBIZ, KAM_SHORT, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 06:26:41 -0000 On Sat, Dec 26, 2020 at 7:39 AM H.J. Lu wrote: > > On Sat, Dec 26, 2020 at 7:32 AM Florian Weimer wrote: > > > > * Fangrui Song: > > > > > Hi, I filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98112 which > > > proposes -fdirect-access-external-data to address some x86-64 > > > GCC/binutils pain[1] and also benefit non-x86 architectures (also see [1] > > > it can prevent copy relocations). > > > > > > [1] Mentioned in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98112#c2 > > > > > > Since I am going to add this option to Clang and I hope (once GCC decides to > > > implement this option the two compilers can use the same option name), I bring > > > it to your attention. > > > > One worry I have is that people start building shared objects with > > direct data access, expecting the main program to be built with > > indirect access. We already see this today with Qt. It's not really > > supported well by the toolchain and causes frequent issues. > > It can be solved by ABI extension implemented in linker, ld.so and > compiler. > > > Depending on the ELF ABI in question, the new pair of -f options might > > not actually be meaningful. It really depends on whether you have > > reasonably-sized displacements available. I think there are some ABIs > > where the optimization is theoretically possible, but impractical > > because the ilimit it imposes on data segment (think AArch64 without > > adrp). > > > > -- > H.J. Please check out new comments on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98112 -fdirect-access-external-data is still the best name. The option is useful to avoid copy relocations / "canonical PLT entry" (st_shndx=0,st_value!=0) in -fno-pic code. I will proceed with my Clang patch.