Index: uspace/lib/c/generic/rtld/module.c
===================================================================
--- uspace/lib/c/generic/rtld/module.c	(revision dd7df1cd6dbadcfeee4d7063c1dff2bcf88c8521)
+++ uspace/lib/c/generic/rtld/module.c	(revision a38d50441a00157a8528ae5eeedffc144c4df62e)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2008 Jiri Svoboda
+ * Copyright (c) 2024 Jiri Svoboda
  * All rights reserved.
  *
@@ -343,9 +343,21 @@
 {
 	list_foreach(rtld->modules, modules_link, module_t, m) {
-		/* Skip rtld module, since it has already been processed */
-		if (m != &rtld->rtld) {
+		/*
+		 * Skip rtld module, since it has already been processed.
+		 * Skip start / main program -- leave it for later
+		 */
+		if (m != &rtld->rtld && m != start) {
 			module_process_relocs(m);
 		}
 	}
+
+	/*
+	 * Now that shared libraries have been processed and their variables
+	 * are thus initialized, we can process the main program,
+	 * which may contain COPY relocations that copy value from shared
+	 * library variables to instances of those variables defined
+	 * in the main program.
+	 */
+	module_process_relocs(start);
 }
 
