From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21287 invoked by alias); 19 Feb 2014 13:57:44 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 21277 invoked by uid 89); 19 Feb 2014 13:57:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qg0-f43.google.com Received: from mail-qg0-f43.google.com (HELO mail-qg0-f43.google.com) (209.85.192.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 19 Feb 2014 13:57:42 +0000 Received: by mail-qg0-f43.google.com with SMTP id f51so634554qge.2 for ; Wed, 19 Feb 2014 05:57:40 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.236.129.198 with SMTP id h46mr43357872yhi.17.1392818260465; Wed, 19 Feb 2014 05:57:40 -0800 (PST) Received: by 10.170.83.7 with HTTP; Wed, 19 Feb 2014 05:57:40 -0800 (PST) Date: Wed, 19 Feb 2014 13:57:00 -0000 Message-ID: Subject: Moving C++ code to a different ELF section From: Saul Tamari To: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-SW-Source: 2014-02/txt/msg00107.txt.bz2 Hi, I'm trying to move some C++ code to a different ELF section and am facing some errors which I don't understand. I'm using g++ v4.8.1 on x86. When compiling the following code I'm getting these errors: /tmp/ccpp2AkE.s: Assembler messages: /tmp/ccpp2AkE.s:63: Error: CFI instruction used without previous .cfi_startproc /tmp/ccpp2AkE.s:64: Error: CFI instruction used without previous .cfi_startproc /tmp/ccpp2AkE.s:66: Error: .cfi_endproc without corresponding .cfi_startproc /tmp/ccpp2AkE.s: Error: open CFI at the end of file; missing .cfi_endproc directive The source is: #include #include int qqq; int main(int argc, char* argv[]) { std::cout << "hey " << std::endl; qqq = rand(); if (qqq > 0x1000000) { asm volatile ("jmp 1f \n\t .pushsection __kuku,\"ax\",@progbits \n\t 1:"); std::cout << "0x123456" << std::endl; throw 12345; asm volatile("jmp 3f \n\t .popsection \n\t 3:"); } return 0; } What do these errors mean? Is there a way to fix them? Is there an alternate method to move similar code to a different section? Thanks, Saul