URL: <http://savannah.nongnu.org/bugs/?35500>
Summary: --gc-sections doesn't track use via --defsym Project: AVR C Runtime Library Submitted by: dkinzer Submitted on: Fri 10 Feb 2012 08:17:12 AM PST Category: None Severity: 3 - Normal Priority: 5 - Normal Item Group: None Status: None Percent Complete: 0% Assigned to: None Open/Closed: Open Discussion Lock: Any Release: 1.6.7 Fixed Release: None _______________________________________________________ Details: I'm not sure that this is the right place to report this problem but I'll do so as a first step. I have a use case where I need to perform link-time mapping of a function call to one of several differently named candidates having the same parameter lists and return type. In the actual use case all of the candidate functions are in a library but that fact is not relevant to the problem that arises. The attached .c and makefile can be used to observe the problem. In this simple test case, main calls a non-existent function "foo" and the linker option --defsym,foo=foo2 is used to map the call to the desired function. If the link step is performed without the --gc-sections option, the resulting executable is correct as shown in this .lss excerpt: 000000e0 <main>: e0: f7 df rcall .-18 ; 0xd0 <foo2> e2: ff cf rjmp .-2 ; 0xe2 <main+0x2> However, adding --gc-sections to the link options produces this code with warning or error messages: 000000c8 <main>: c8: 9b df rcall .-202 ; 0x0 <__vectors> ca: ff cf rjmp .-2 ; 0xca <main+0x2> The resulting load image contains none of the candidate functions indicating the the linker code that eliminates unused functions believed that they were all unused even though "foo2" should have been marked as used. This issue was observed with v4.3.3. I haven't tested this with a later version of the toolchain. _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Fri 10 Feb 2012 08:17:12 AM PST Name: t.c Size: 210B By: dkinzer <http://savannah.nongnu.org/bugs/download.php?file_id=25040> ------------------------------------------------------- Date: Fri 10 Feb 2012 08:17:12 AM PST Name: makefile Size: 839B By: dkinzer <http://savannah.nongnu.org/bugs/download.php?file_id=25041> _______________________________________________________ Reply to this item at: <http://savannah.nongnu.org/bugs/?35500> _______________________________________________ Message sent via/by Savannah http://savannah.nongnu.org/ _______________________________________________ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-libc-dev