This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Heads-Up: early LTO debug to land, breaking Mach-O / [X]COFF


Hi Richard,

> On Fri, 12 May 2017, Richard Biener wrote:
>
>> 
>> This is a heads-up that I am in the process of implementing the last
>> of Jasons review comments on the dwarf2out parts of early LTO debug
>> support.  I hope to post final patches early next week after thoroughly
>> re-testing everything.
>> 
>> Note that Mach-O and [X]COFF support in the simple-object machinery
>> is still missing for the early LTO debug feature so I am going to
>> break LTOing with DWARF debuginfo on Darwin and Windows (CCing
>> maintainers).  Mach-O support has been worked on a bit by Iain
>> and myself but the simple-object piece is still missing.
>> A workaround is to use stabs on these targets with LTO.

unfortunately, the patch not only broke LTO on Darwin, but bootstrap
completely (seen on x86_64-apple-darwin17.0.0):

/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c: In function 'void init_sections_and_labels(bool)':
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: error: '%ld' directive writing between 1 and 10 bytes into a region of size 9 [-Werror=format-overflow=]
 init_sections_and_labels (bool early_lto_debug)
 ^~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: note: directive argument in the range [0, 4294967295]
In file included from ./tm.h:21:0,
                 from /var/gcc/src/hg/trunk/local/gcc/target.h:52,
                 from /var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:61:
/var/gcc/src/hg/trunk/local/gcc/config/darwin.h:759:15: note: 'sprintf' output between 23 and 32 bytes into a destination of size 30
       sprintf (LABEL, "*%s%ld", PREFIX, (long)(NUM)); \
       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27210:4: note: in expansion of macro 'ASM_GENERATE_INTERNAL_LABEL'
    ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_line_section_label,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: error: '%ld' directive writing between 1 and 10 bytes into a region of size 7 [-Werror=format-overflow=]
 init_sections_and_labels (bool early_lto_debug)
 ^~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: note: directive argument in the range [0, 4294967295]
In file included from ./tm.h:21:0,
                 from /var/gcc/src/hg/trunk/local/gcc/target.h:52,
                 from /var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:61:
/var/gcc/src/hg/trunk/local/gcc/config/darwin.h:759:15: note: 'sprintf' output between 25 and 34 bytes into a destination of size 30
       sprintf (LABEL, "*%s%ld", PREFIX, (long)(NUM)); \
       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27229:4: note: in expansion of macro 'ASM_GENERATE_INTERNAL_LABEL'
    ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_abbrev_section_label,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: error: '%ld' directive writing between 1 and 10 bytes into a region of size 9 [-Werror=format-overflow=]
 init_sections_and_labels (bool early_lto_debug)
 ^~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: note: directive argument in the range [0, 4294967295]
In file included from ./tm.h:21:0,
                 from /var/gcc/src/hg/trunk/local/gcc/target.h:52,
                 from /var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:61:
/var/gcc/src/hg/trunk/local/gcc/config/darwin.h:759:15: note: 'sprintf' output between 23 and 32 bytes into a destination of size 30
       sprintf (LABEL, "*%s%ld", PREFIX, (long)(NUM)); \
       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27238:4: note: in expansion of macro 'ASM_GENERATE_INTERNAL_LABEL'
    ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_line_section_label,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: error: '%ld' directive writing between 1 and 10 bytes into a region of size 9 [-Werror=format-overflow=]
 init_sections_and_labels (bool early_lto_debug)
 ^~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: note: directive argument in the range [0, 4294967295]
In file included from ./tm.h:21:0,
                 from /var/gcc/src/hg/trunk/local/gcc/target.h:52,
                 from /var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:61:
/var/gcc/src/hg/trunk/local/gcc/config/darwin.h:759:15: note: 'sprintf' output between 23 and 32 bytes into a destination of size 30
       sprintf (LABEL, "*%s%ld", PREFIX, (long)(NUM)); \
       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27245:4: note: in expansion of macro 'ASM_GENERATE_INTERNAL_LABEL'
    ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_info_section_label,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: error: '%ld' directive writing between 1 and 10 bytes into a region of size 7 [-Werror=format-overflow=]
 init_sections_and_labels (bool early_lto_debug)
 ^~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: note: directive argument in the range [0, 4294967295]
In file included from ./tm.h:21:0,
                 from /var/gcc/src/hg/trunk/local/gcc/target.h:52,
                 from /var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:61:
/var/gcc/src/hg/trunk/local/gcc/config/darwin.h:759:15: note: 'sprintf' output between 25 and 34 bytes into a destination of size 30
       sprintf (LABEL, "*%s%ld", PREFIX, (long)(NUM)); \
       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27290:4: note: in expansion of macro 'ASM_GENERATE_INTERNAL_LABEL'
    ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_abbrev_section_label,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: error: '%ld' directive writing between 1 and 10 bytes into a region of size 9 [-Werror=format-overflow=]
 init_sections_and_labels (bool early_lto_debug)
 ^~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: note: directive argument in the range [0, 4294967295]
In file included from ./tm.h:21:0,
                 from /var/gcc/src/hg/trunk/local/gcc/target.h:52,
                 from /var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:61:
/var/gcc/src/hg/trunk/local/gcc/config/darwin.h:759:15: note: 'sprintf' output between 23 and 32 bytes into a destination of size 30
       sprintf (LABEL, "*%s%ld", PREFIX, (long)(NUM)); \
       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27300:4: note: in expansion of macro 'ASM_GENERATE_INTERNAL_LABEL'
    ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_line_section_label,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: error: '%ld' directive writing between 1 and 10 bytes into a region of size 9 [-Werror=format-overflow=]
 init_sections_and_labels (bool early_lto_debug)
 ^~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27184:1: note: directive argument in the range [0, 4294967295]
In file included from ./tm.h:21:0,
                 from /var/gcc/src/hg/trunk/local/gcc/target.h:52,
                 from /var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:61:
/var/gcc/src/hg/trunk/local/gcc/config/darwin.h:759:15: note: 'sprintf' output between 23 and 32 bytes into a destination of size 30
       sprintf (LABEL, "*%s%ld", PREFIX, (long)(NUM)); \
       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/gcc/src/hg/trunk/local/gcc/dwarf2out.c:27306:4: note: in expansion of macro 'ASM_GENERATE_INTERNAL_LABEL'
    ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_info_section_label,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~

I hacked around this using the following patch:

diff -r a01355d9dbd3 gcc/dwarf2out.c
--- a/gcc/dwarf2out.c	Wed Aug 23 17:09:11 2017 +0200
+++ b/gcc/dwarf2out.c	Wed Aug 23 20:50:16 2017 +0200
@@ -178,7 +178,7 @@
 static GTY(()) section *debug_frame_section;
 
 /* Maximum size (in bytes) of an artificially generated label.  */
-#define MAX_ARTIFICIAL_LABEL_BYTES	30
+#define MAX_ARTIFICIAL_LABEL_BYTES	40
 
 /* According to the (draft) DWARF 3 specification, the initial length
    should either be 4 or 12 bytes.  When it's 12 bytes, the first 4
40 is just a value that happened to work; I've done no analysis what's
really required.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]