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: unassig...@gcc.gnu.org

        ReportedBy: si...@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.

Reply via email to