Index: uspace/app/dltest/dltest.c
===================================================================
--- uspace/app/dltest/dltest.c	(revision c21d4d64870698b91707f203def6398db79bff84)
+++ uspace/app/dltest/dltest.c	(revision cb747b3b787df15184afceecdeef820cfe7e4226)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2016 Jiri Svoboda
+ * Copyright (c) 2024 Jiri Svoboda
  * All rights reserved.
  *
@@ -571,4 +571,29 @@
 #ifdef DLTEST_LINKED
 
+/** Test if we can read the correct value of a public pointer variable.
+ *
+ * dl_public_ptr_var is initialized in libdltest to point to dl_public_var.
+ * This is done using a relocation. The main program (unless compiled with
+ * PIC or PIE) will contain a copy of dl_public_ptr_var. This needs
+ * to be copied using a COPY relocation. The relocations in the main
+ * program need to be processed after the relocations in the shared
+ * libraries (so that we copy the correct value).
+ */
+static bool test_public_ptr_var(void)
+{
+	int *ptr;
+
+	printf("Read dl_public_ptr_var directly...\n");
+	ptr = dl_public_ptr_var;
+
+	if (ptr != &dl_public_var) {
+		printf("FAILED\n");
+		return false;
+	}
+
+	printf("Passed\n");
+	return true;
+}
+
 /** Test directly calling function that returns a constant */
 static bool test_lnk_dl_get_constant(void)
@@ -920,4 +945,5 @@
 
 #ifndef STATIC_EXE
+
 	if (!test_dlfcn_dl_get_private_fib_var())
 		return 1;
@@ -974,4 +1000,7 @@
 
 	if (!test_lnk_read_public_uvar())
+		return 1;
+
+	if (!test_public_ptr_var())
 		return 1;
 
