From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id A6ADE385DC06 for ; Wed, 15 Apr 2020 06:15:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A6ADE385DC06 Received: by mail-lf1-x135.google.com with SMTP id m2so1688864lfo.6 for ; Tue, 14 Apr 2020 23:15:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XjGbNGYb/iKrXOQszG7MCXTiHcqXU4J3f7Ksiyev3kU=; b=IwlWApE7HkjS7uF9P6nIFtm2ivPn11JdGfzNTebaWFfIrHrdCgniEA+I0iffvF0e1d 8d9n1Oup++QuG9SD4p2YBa+iXw0T+CUYWtHIAobxjMmNm4RfrzSlpBKoygXVG8S90eTk 6EVQC0FUzMyOnQaghkPai75mb/508zY0CnXvlHXUOWs9zZzn6ZTv0h/THIfczIjrfb7G +1U8ER5aifH5J3uXJ0tQaq7KuzX6OPDIR1wA2AsvkEU2ipyb8kuIvUXeF9Hgc3g18GnG kOIma/lQlTJjco5BCLc+qSuKDui6KgvGuZ571WwxxQFToEHRWCg3LN/0N7dazYVdVBLe ixPA== X-Gm-Message-State: AGi0Pub4No/eZ7l3MZizikdqITVb0yrdHKKWAgC1d39J0IxYwBPjuC27 2a51bHEtGVN/9Aa9abm8fFxPJY4V5Q2ziYop46UWOw== X-Google-Smtp-Source: APiQypKkmHF6uA+PVLy/vMVYnhYgU92brSMXLRzwZj9AqpJ1N4NDOLzk4MPu9K7QCvkS70cs3r1FAl1saQr/ffwa8Gc= X-Received: by 2002:ac2:5c07:: with SMTP id r7mr2118601lfp.160.1586931339482; Tue, 14 Apr 2020 23:15:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Wed, 15 Apr 2020 08:15:27 +0200 Message-ID: Subject: Re: Section pragmas To: Yousef Cc: "gcc-help@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2020 06:15:42 -0000 On Wed, Apr 15, 2020 at 1:22 AM Yousef via Gcc wrote: > > Hi > > I am very shocked to find out that GCC GNU does not support section > pragams. I have to declare an attribute for every single variable and > function for hundreds of files where I can just use few pragmas on other > compilers. > > I do not understand why would GNU discourage the use of pragmas where they > can be so useful. I understand that I can use linked scripts but that > requires organization of object files and for a lot of cases it is much > more effective to do that in the codebase. I am really really shocked!! > > I hope future releases will change this attitude against pragmas. Very > disappointing! > > Is there any way that I can use the attribution section for multiple lines > of code rather than doing it for every line? (No I will not do it in a > linker script) Please don't cross-post. You can use a macro to make the repetition shorter/nicer: #define SEC_FOO __attribute__((section("foo"))) void SEC_FOO bar() {} ... GCC is a community effort and any help is welcome - if you're in the need of a feature feel free to contribute! Richard. > Thanks!