From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22532 invoked by alias); 22 Aug 2017 12:17:56 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 22476 invoked by uid 89); 22 Aug 2017 12:17:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Aug 2017 12:17:47 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0F61AAB22; Tue, 22 Aug 2017 12:17:45 +0000 (UTC) Date: Tue, 22 Aug 2017 13:29:00 -0000 From: Richard Biener To: Szabolcs Nagy cc: nd@arm.com, Jason Merrill , gcc-patches List Subject: Re: [PATCH][2/2] early LTO debug, main part In-Reply-To: <599C182C.4060700@arm.com> Message-ID: References: <7c94dcc5-ee25-76ca-8abb-e0a22b57cba2@redhat.com> <599C03B7.8050009@arm.com> <599C182C.4060700@arm.com> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2017-08/txt/msg01270.txt.bz2 On Tue, 22 Aug 2017, Szabolcs Nagy wrote: > On 22/08/17 11:17, Richard Biener wrote: > > On Tue, 22 Aug 2017, Szabolcs Nagy wrote: > >> on aarch64_be-none-elf i see > >> > >> PASS->FAIL: gcc.dg/debug/pr41893-1.c -gdwarf-2 (test for excess errors) > >> PASS->FAIL: gcc.dg/debug/pr41893-1.c -gdwarf-2 -O (test for excess errors) > >> PASS->FAIL: gcc.dg/debug/pr41893-1.c -gdwarf-2 -O3 (test for excess errors) > >> PASS->FAIL: gcc.dg/debug/pr41893-1.c -gdwarf-2 -g1 (test for excess errors) > >> PASS->FAIL: gcc.dg/debug/pr41893-1.c -gdwarf-2 -g1 -O (test for excess errors) > >> PASS->FAIL: gcc.dg/debug/pr41893-1.c -gdwarf-2 -g1 -O3 (test for excess errors) > >> PASS->FAIL: gcc.dg/debug/pr41893-1.c -gdwarf-2 -g3 (test for excess errors) > >> PASS->FAIL: gcc.dg/debug/pr41893-1.c -gdwarf-2 -g3 -O (test for excess errors) > >> PASS->FAIL: gcc.dg/debug/pr41893-1.c -gdwarf-2 -g3 -O3 (test for excess errors) > >> PASS->FAIL: gcc.dg/lto/20090914-1 c_lto_20090914-1_0.o-c_lto_20090914-1_0.o link, -flto > >> PASS->FAIL: gcc.dg/lto/20100426 c_lto_20100426_0.o-c_lto_20100426_0.o link, -r -nostdlib -flto -g > >> PASS->FAIL: gcc.dg/lto/20111207-2 c_lto_20111207-2_0.o-c_lto_20111207-2_0.o link, -g -O -flto > >> PASS->FAIL: gcc.dg/lto/20111213-1 c_lto_20111213-1_0.o-c_lto_20111213-1_0.o link, -flto -g > >> PASS->FAIL: gcc.dg/lto/pr51572-1 c_lto_pr51572-1_0.o-c_lto_pr51572-1_0.o link, -flto -g > >> PASS->FAIL: gcc.dg/lto/pr53470 c_lto_pr53470_0.o-c_lto_pr53470_0.o link, -flto -g > >> PASS->FAIL: gcc.dg/lto/pr59323 c_lto_pr59323_0.o-c_lto_pr59323_0.o link, -O2 -g -flto > >> PASS->FAIL: gcc.dg/lto/pr59323-2 c_lto_pr59323-2_0.o-c_lto_pr59323-2_0.o link, -O2 -g -flto > >> PASS->FAIL: gcc.dg/pr43557-1.c (test for excess errors) > >> > >> linking seems to fail with > >> > >> /tmp/ccqAb1Wfdebugobjtem: file not recognized: Bad value > >> collect2: error: ld returned 1 exit status > >> lto-wrapper: fatal error: B/gcc/xgcc returned 1 exit status > >> compilation terminated. > >> P/aarch64_be-none-elf/bin/ld: error: lto-wrapper failed > >> collect2: error: ld returned 1 exit status > >> compiler exited with status 1 > > > > Can you file a bugreport please? Can you investigate a bit, I suspect > > a simple int main() {} and ./xgcc -B. -flto -g t.c fails the same way. > > With -save-temps -v you should be able to inspect the generated > > debugobj with readelf. > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81925 > > i could not figure much out, readelf could parse lto1 input > but printed errors on the final link command input. > > > Is this a native compiler or a cross-compiler? [I suspect endianess > > issues somewhere?] > > cross compiler (from aarch64-linux-gnu to aarch64_be-none-elf) I am testing the following fix (verified with a cross), will apply as obvious if that succeeds. Richard. 2017-08-22 Richard Biener PR lto/81925 * simple-object-elf.c (simple_object_elf_write_shdr): Adjust type of sh_addralign and sh_entsize and properly write sh_entsize as Elf_Addr. (simple_object_elf_write_to_file): Read sh_entsize as Elf_Addr. Index: libiberty/simple-object-elf.c =================================================================== --- libiberty/simple-object-elf.c (revision 251273) +++ libiberty/simple-object-elf.c (working copy) @@ -830,8 +830,8 @@ simple_object_elf_write_shdr (simple_obj off_t sh_addr, unsigned int sh_offset, unsigned int sh_size, unsigned int sh_link, unsigned int sh_info, - unsigned int sh_addralign, - unsigned int sh_entsize, + size_t sh_addralign, + size_t sh_entsize, const char **errmsg, int *err) { struct simple_object_elf_attributes *attrs = @@ -858,7 +858,7 @@ simple_object_elf_write_shdr (simple_obj ELF_SET_FIELD (fns, cl, Shdr, buf, sh_link, Elf_Word, sh_link); ELF_SET_FIELD (fns, cl, Shdr, buf, sh_info, Elf_Word, sh_info); ELF_SET_FIELD (fns, cl, Shdr, buf, sh_addralign, Elf_Addr, sh_addralign); - ELF_SET_FIELD (fns, cl, Shdr, buf, sh_entsize, Elf_Word, sh_entsize); + ELF_SET_FIELD (fns, cl, Shdr, buf, sh_entsize, Elf_Addr, sh_entsize); return simple_object_internal_write (descriptor, offset, buf, shdr_size, errmsg, err); @@ -948,8 +948,8 @@ simple_object_elf_write_to_file (simple_ off_t sh_addr = 0; unsigned int sh_link = 0; unsigned int sh_info = 0; - unsigned int sh_addralign = 1U << section->align; - unsigned int sh_entsize = 0; + size_t sh_addralign = 1U << section->align; + size_t sh_entsize = 0; if (eow->shdrs) { sh_type = ELF_FETCH_FIELD (attrs->type_functions, attrs->ei_class, Shdr, @@ -972,7 +972,7 @@ simple_object_elf_write_to_file (simple_ sh_addralign, Elf_Addr); sh_entsize = ELF_FETCH_FIELD (attrs->type_functions, attrs->ei_class, Shdr, eow->shdrs + secnum * shdr_size, - sh_entsize, Elf_Word); + sh_entsize, Elf_Addr); secnum++; }