From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3025 invoked by alias); 14 Mar 2013 12:25:36 -0000 Received: (qmail 2599 invoked by uid 48); 14 Mar 2013 12:24:29 -0000 From: "simon at pushface dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ada/56616] New: gnatmake builds SAL incorrectly if library_kind is "static" Date: Thu, 14 Mar 2013 12:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ada X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: simon at pushface dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-03/txt/msg01070.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56616 Bug #: 56616 Summary: gnatmake builds SAL incorrectly if library_kind is "static" Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada AssignedTo: unassigned@gcc.gnu.org ReportedBy: simon@pushface.org Created attachment 29665 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29665 Reproducer Gnatmake will accept a GPR which calls for a stand-alone static library. The library that is created will not work if the library implementation requires linking or elaboration that is not already implied by the user program or the library interface units: for example, if the library implementation uses tasking but the user program does not, either libgnarl won't be included in the link or tasking won't be initialized (so only the first entry in the environment task's TCB's Entry_Calls is initialized). I beg you not to respond by disabling static SALs: the ability to populate the Library_Src_Dir with the library's interface source is valuable. Using the attached demonstrator (static-sal-bug.tar.gz) results in $ gnatmake -p -P build_library.gpr object directory "/Users/simon/tmp/static-sal-bug/.build-lib" created for project build_library library directory "/Users/simon/tmp/static-sal-bug/lib" created for project build_library library source copy directory "/Users/simon/tmp/static-sal-bug/include" created for project build_library gcc -c -g -I- -gnatA /Users/simon/tmp/static-sal-bug/src/library.adb gcc -c -g -I- -gnatA /Users/simon/tmp/static-sal-bug/src/library_impl.adb gnatbind -n -o b~ibrary.adb -Library -a ... gcc -c -gnatws b~ibrary.adb -fPIC -g ... building static library for project build_library ar cr /Users/simon/tmp/static-sal-bug/lib/libibrary.a /Users/simon/tmp/static-sal-bug/.build-lib/b~ibrary.o ... ranlib /Users/simon/tmp/static-sal-bug/lib/libibrary.a $ gnatmake -p -P locking.gpr object directory "/Users/simon/tmp/static-sal-bug/.build" created for project locking gcc -c -g -I- -gnatA /Users/simon/tmp/static-sal-bug/locking.adb gnatbind -E -x /Users/simon/tmp/static-sal-bug/.build/locking.ali gnatlink /Users/simon/tmp/static-sal-bug/.build/locking.ali -g /Users/simon/tmp/static-sal-bug/lib/libibrary.a -Wl,-rpath,/opt/gcc-4.8-196573/lib/gcc/x86_64-apple-darwin12/4.8.0/adalib/ -o /Users/simon/tmp/static-sal-bug/locking Undefined symbols for architecture x86_64: "_system__tasking__protected_objects__entries__finalize__2", referenced from: _library_impl__poTVDF in libibrary.a(library_impl.o) _library_impl__poTVIP__F12b.3417 in libibrary.a(library_impl.o) "_system__tasking__protected_objects__entries__initialize_protection_entries", referenced from: _library_impl__poTVIP in libibrary.a(library_impl.o) "_system__tasking__protected_objects__entries__lock_entries", referenced from: _library_impl__po__releaseP in libibrary.a(library_impl.o) "_system__tasking__protected_objects__entries__protection_entriesIP", referenced from: _library_impl__poTVIP in libibrary.a(library_impl.o) "_system__tasking__protected_objects__operations__communication_blockIP", referenced from: _library_impl__seize in libibrary.a(library_impl.o) "_system__tasking__protected_objects__operations__complete_entry_body", referenced from: _library_impl__po__seize_E3b in libibrary.a(library_impl.o) "_system__tasking__protected_objects__operations__exceptional_complete_entry_body", referenced from: _library_impl__po__seize_E3b in libibrary.a(library_impl.o) "_system__tasking__protected_objects__operations__protected_entry_call", referenced from: _library_impl__seize in libibrary.a(library_impl.o) "_system__tasking__protected_objects__operations__service_entries", referenced from: _library_impl__po__releaseP___finalizer.3471 in libibrary.a(library_impl.o) ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status gnatlink: error when calling /opt/gcc-4.8-196573/bin/gcc gnatmake: *** link failed.