aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-gc/pr19161-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-gc/pr19161-2.c')
-rw-r--r--ld/testsuite/ld-gc/pr19161-2.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ld/testsuite/ld-gc/pr19161-2.c b/ld/testsuite/ld-gc/pr19161-2.c
new file mode 100644
index 0000000..b51f31a
--- /dev/null
+++ b/ld/testsuite/ld-gc/pr19161-2.c
@@ -0,0 +1,19 @@
+int __attribute__((section("my_section"))) a[2] = {0x1234, 0x5678};
+
+extern int __start_my_section;
+
+extern int (*p)(void);
+
+int
+dump()
+{
+ int* ap = &__start_my_section;
+ return ap[0];
+}
+
+void
+__attribute__((constructor))
+foo()
+{
+ p = dump;
+}