] \
]
+set merge_exec_tests {
+ {"merge4" "" ""
+ {merge4a.c merge4b.s} "merge4" "merge4.out"}
+}
+run_ld_link_exec_tests $merge_exec_tests
+
catch "exec rm -f tmpdir/preinit tmpdir/init tmpdir/fini tmpdir/init-mixed" status
--- /dev/null
+extern const char * getstr3(int);
+extern int printf (const char *, ...);
+
+extern const char *addr_of_str;
+extern const char *addr_of_str2;
+
+/* "foobar" needs to be a string literal, so that it's put into
+ a mergable string section, then merged with the "foobar" from merge4b.s
+ and then (when the linker is buggy) doesn't cover the additional
+ nul byte after "foobar" in the asm source (which addr_of_str2 is supposed
+ to point into. */
+const char * getstr3(int i)
+{
+ return i ? "blabla" : "foobar";
+}
+
+int main(void)
+{
+ printf ("1: %s\n", addr_of_str);
+ printf ("2: %s\n", addr_of_str2);
+ printf ("3: %s\n", getstr3(1));
+ return 0;
+}
--- /dev/null
+/* Check that pointing into padding zeros of string sections works. */
+ .section .rodata.str1.1,"aMS",@progbits,1
+ .string ""
+.LC0:
+ .string "foobar"
+1:
+ .string ""
+ .string "whatever"
+ .section .data
+ .globl addr_of_str
+ .type addr_of_str, @object
+addr_of_str:
+ .dc.a str
+ .globl addr_of_str2
+ .type addr_of_str2, @object
+addr_of_str2:
+ .dc.a 1b
+ .section .rodata
+ .type str, @object
+ .size str, 7
+str:
+ .string "foobar"
+ .section .note.GNU-stack,"",@progbits