lib/csu: do not compile the body of handle_static_init() for PIC build at all

The referenced symbols that provide init array boundaries are weak,
hidden, and undefined.  The code that iterates over that arrays is not
used for the case when libc is compiled as dso.

This should fix linking with ld.bfd.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
This commit is contained in:
Konstantin Belousov 2023-03-12 03:45:37 +02:00
parent 94e3409e2d
commit c383f4857f

View File

@ -94,6 +94,7 @@ finalizer(void)
static void
handle_static_init(int argc, char **argv, char **env)
{
#ifndef PIC
void (*fn)(int, char **, char **);
size_t array_size, n;
@ -115,6 +116,7 @@ handle_static_init(int argc, char **argv, char **env)
if ((uintptr_t)fn != 0 && (uintptr_t)fn != 1)
fn(argc, argv, env);
}
#endif
}
static void