Messages in this thread | | | From | David Laight <> | Subject | RE: [PATCH] iwl4965: Enable checking of format strings | Date | Fri, 13 Feb 2015 11:20:47 +0000 |
| |
From: Rasmus Villemoes > Well, probably the linker is allowed to overlap "anonymous" objects > (string literals) with whatever const char[] (or indeed any const) > object it finds containing the appropriate byte sequence. But I think > language lawyers would insist that for > > const char foo[] = "a string"; > const char bar[] = "a string";
A quick test shows those are separate strings. But 'const char *foo = "xxx";' will share. You also need -O1 to get the strings into .rodata.str.n so that the linker can merge them.
David
| |