From c0c051799d2c611f29038ff7dc6e9b81d8006d4e Mon Sep 17 00:00:00 2001 From: Johannes Kliemann Date: Mon, 11 Nov 2024 16:15:47 +0100 Subject: [PATCH] Add -lc and -pthread to shared library builds The option -nostdlib that is used for shared library builds also removes -lc and -pthread. While this does not immediately cause problems when building the shared version of the runtime it won't use the correct symbol versions causing it to use the wrong version of some libc symbols. ref eng/cert/certified-rts#145 --- support/data/target_options.gpr.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/support/data/target_options.gpr.in b/support/data/target_options.gpr.in index 1b29d4ce..0a210760 100644 --- a/support/data/target_options.gpr.in +++ b/support/data/target_options.gpr.in @@ -52,8 +52,9 @@ abstract project Target_Options is -- link against libgnat (itself). -- Since -nostdlib also removes libgcc -- from the linked libraries we have to - -- add -lgcc again. - LOPTIONS := LOPTIONS & ("-nostdlib", "-lgcc"); + -- add -lc and -lgcc again. + -- Also add -pthread in case it is not already included in -lc. + LOPTIONS := LOPTIONS & ("-nostdlib", "-lc", "-lgcc", "-pthread"); end case; -- Concatenate with common flags