
to check a situation that once failed with the new section merging when it mishandled offsets pointing into alignment padding in mergable string sections (i.e. pointing to zeros). It made bootstrap.exp fail but that depends on many factors to actually go wrong so this is a more explicit variant of it.
23 lines
649 B
C
23 lines
649 B
C
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;
|
|
}
|