From owner-freebsd-mips@FreeBSD.ORG Sun Jul 27 01:03:22 2014 Return-Path: Delivered-To: freebsd-mips@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5D3584A5 for ; Sun, 27 Jul 2014 01:03:22 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 441732359 for ; Sun, 27 Jul 2014 01:03:22 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.8/8.14.8) with ESMTP id s6R13M86043521 for ; Sun, 27 Jul 2014 01:03:22 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-mips@FreeBSD.org Subject: [Bug 191587] [mips] 'strip' corrupts static libraries Date: Sun, 27 Jul 2014 01:03:21 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: sbruno@FreeBSD.org X-Bugzilla-Status: Needs Triage X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: freebsd-mips@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 01:03:22 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191587 --- Comment #11 from Sean Bruno --- This does *not* happen on a mips32 build: ===> Staging for pkg-1.3.0 ===> Generating temporary packing list if test -z 'strip'; then /usr/bin/make INSTALL_PROGRAM="/bin/sh /usr/ports/ports-mgmt/pkg/work/pkg-1.3.0/install-sh -c -s" install_sh_PROGRAM="/bin/sh /usr/ports/ports-mgmt/pkg/work/pkg-1.3.0/install-sh -c -s" INSTALL_STRIP_FLAG=-s install; else /usr/bin/make INSTALL_PROGRAM="/bin/sh /usr/ports/ports-mgmt/pkg/work/pkg-1.3.0/install-sh -c -s" install_sh_PROGRAM="/bin/sh /usr/ports/ports-mgmt/pkg/work/pkg-1.3.0/install-sh -c -s" INSTALL_STRIP_FLAG=-s "INSTALL_PROGRAM_ENV=STRIPPROG='strip'" install; fi Making install in external /usr/bin/make install-am Making install in libpkg Making install in repo Making install in binary Making install in . /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/lib' /bin/sh ../libtool --mode=install /usr/bin/install -c -o root -g wheel -s libpkg.la libpkg_static.la '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/lib' libtool: install: /usr/bin/install -c -o root -g wheel .libs/libpkg.so.3.0.0 /usr/ports/ports-mgmt/pkg/work/stage/usr/local/lib/libpkg.so.3.0.0 libtool: install: strip --strip-unneeded /usr/ports/ports-mgmt/pkg/work/stage/usr/local/lib/libpkg.so.3.0.0 libtool: install: (cd /usr/ports/ports-mgmt/pkg/work/stage/usr/local/lib && { ln -s -f libpkg.so.3.0.0 libpkg.so.3 || { rm -f libpkg.so.3 && ln -s libpkg.so.3.0.0 libpkg.so.3; }; }) libtool: install: (cd /usr/ports/ports-mgmt/pkg/work/stage/usr/local/lib && { ln -s -f libpkg.so.3.0.0 libpkg.so || { rm -f libpkg.so && ln -s libpkg.so.3.0.0 libpkg.so; }; }) libtool: install: /usr/bin/install -c -o root -g wheel .libs/libpkg.lai /usr/ports/ports-mgmt/pkg/work/stage/usr/local/lib/libpkg.la libtool: install: /usr/bin/install -c -o root -g wheel .libs/libpkg_static.lai /usr/ports/ports-mgmt/pkg/work/stage/usr/local/lib/libpkg_static.la libtool: install: /usr/bin/install -c -o root -g wheel .libs/libpkg_static.a /usr/ports/ports-mgmt/pkg/work/stage/usr/local/lib/libpkg_static.a libtool: install: strip --strip-debug /usr/ports/ports-mgmt/pkg/work/stage/usr/local/lib/libpkg_static.a libtool: install: chmod 644 /usr/ports/ports-mgmt/pkg/work/stage/usr/local/lib/libpkg_static.a libtool: install: ranlib /usr/ports/ports-mgmt/pkg/work/stage/usr/local/lib/libpkg_static.a libtool: install: warning: remember to run `libtool --finish /usr/local/lib' /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/include' install -o root -g wheel -m 444 pkg.h '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/include' Making install in src /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/etc' install -o root -g wheel -m 444 pkg.conf.sample '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/etc' /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/sbin' STRIPPROG='strip' /bin/sh ../libtool --mode=install /bin/sh /usr/ports/ports-mgmt/pkg/work/pkg-1.3.0/install-sh -c -s pkg pkg-static '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/sbin' libtool: install: warning: `../libpkg/libpkg.la' has not been installed in `/usr/local/lib' libtool: install: /bin/sh /usr/ports/ports-mgmt/pkg/work/pkg-1.3.0/install-sh -c -s .libs/pkg /usr/ports/ports-mgmt/pkg/work/stage/usr/local/sbin/pkg libtool: install: /bin/sh /usr/ports/ports-mgmt/pkg/work/pkg-1.3.0/install-sh -c -s pkg-static /usr/ports/ports-mgmt/pkg/work/stage/usr/local/sbin/pkg-static Making install in tests Making install in scripts /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/sbin' install -o root -g wheel -m 555 sbin/pkg2ng '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/sbin' /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/etc/bash_completion.d' install -o root -g wheel -m 444 completion/_pkg.bash '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/etc/bash_completion.d' /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/etc/periodic/daily' install -o root -g wheel -m 444 periodic/411.pkg-backup periodic/490.status-pkg-changes '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/etc/periodic/daily' /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/etc/periodic/security' install -o root -g wheel -m 444 periodic/410.pkg-audit periodic/460.pkg-checksum '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/etc/periodic/security' /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/etc/periodic/weekly' install -o root -g wheel -m 444 periodic/400.status-pkg '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/etc/periodic/weekly' /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/share/zsh/site-functions' install -o root -g wheel -m 444 completion/_pkg.zsh '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/share/zsh/site-functions' Making install in docs /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/man/man3' install -o root -g wheel -m 444 pkg_printf.3 pkg_repos.3 '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/man/man3' /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/man/man5' install -o root -g wheel -m 444 pkg-repository.5 pkg.conf.5 '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/man/man5' /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/man/man8' install -o root -g wheel -m 444 pkg-add.8 pkg-annotate.8 pkg-audit.8 pkg-autoremove.8 pkg-backup.8 pkg-check.8 pkg-clean.8 pkg-config.8 pkg-convert.8 pkg-create.8 pkg-delete.8 pkg-fetch.8 pkg-info.8 pkg-install.8 pkg-lock.8 pkg-query.8 pkg-register.8 pkg-repo.8 pkg-rquery.8 pkg-search.8 pkg-set.8 pkg-shell.8 pkg-shlib.8 pkg-ssh.8 pkg-stats.8 pkg-update.8 pkg-updating.8 pkg-upgrade.8 pkg-version.8 pkg-which.8 pkg.8 '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/man/man8' /usr/bin/make install-data-hook ln -s -f pkg-delete.8 /usr/ports/ports-mgmt/pkg/work/stage/usr/local/man/man8/pkg-remove.8 ln -s -f pkg-lock.8 /usr/ports/ports-mgmt/pkg/work/stage/usr/local/man/man8/pkg-unlock.8 ln -s -f pkg.8 /usr/ports/ports-mgmt/pkg/work/stage/usr/local/man/man8/pkg-static.8 /bin/mkdir -p '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/libdata/pkgconfig' install -o root -g wheel -m 444 libpkg/pkg.pc '/usr/ports/ports-mgmt/pkg/work/stage/usr/local/libdata/pkgconfig' ====> Compressing man pages (compress-man) -- You are receiving this mail because: You are the assignee for the bug. From owner-freebsd-mips@FreeBSD.ORG Sun Jul 27 19:39:36 2014 Return-Path: Delivered-To: freebsd-mips@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB6AE807 for ; Sun, 27 Jul 2014 19:39:36 +0000 (UTC) Received: from cdptpa-oedge-vip.email.rr.com (cdptpa-outbound-snat.email.rr.com [107.14.166.227]) by mx1.freebsd.org (Postfix) with ESMTP id 6E67F2D3C for ; Sun, 27 Jul 2014 19:39:36 +0000 (UTC) Received: from [76.187.139.93] ([76.187.139.93:56185] helo=[192.168.0.30]) by cdptpa-oedge02 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id BE/B3-28694-07555D35; Sun, 27 Jul 2014 19:39:29 +0000 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: mips64 ld GOT problem From: Stacey Son In-Reply-To: <2021F70B-2AA4-412C-8D1B-A8D38A3E031C@FreeBSD.org> Date: Sun, 27 Jul 2014 14:39:27 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <37D1F27C-B595-43AA-A0F8-6B48AE4D7C69@FreeBSD.org> References: <77F1DDA2-A4E5-4D64-AA43-F8CBC55249C4@me.com> <48935A3D-0387-42F1-ACF0-14EB7D8F9A06@bsdimp.com> <2021F70B-2AA4-412C-8D1B-A8D38A3E031C@FreeBSD.org> To: David Chisnall X-Mailer: Apple Mail (2.1878.6) X-RR-Connecting-IP: 107.14.168.130:25 X-Cloudmark-Score: 0 Cc: freebsd-mips@FreeBSD.org X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 19:39:36 -0000 Hi David: Compiling with the cmake option "-DBUILD_SHARED_LIBS=3DTrue" does get it = pass linking 'opt' but it later fails later on... [ 73%] Building CXX object = tools/clang/lib/AST/CMakeFiles/clangAST.dir/VTTBuilder.cpp.o Linking CXX shared library ../../../../lib/libclangAST.so [...] /home/sson/llvm/tools/clang/lib/AST/ASTContext.cpp:(.text+0x710): = relocation truncated to fit: R_MIPS_CALL16 against `bool = llvm::isa(clang::Decl = const* const&)' [...] /home/sson/llvm/tools/clang/lib/AST/ASTContext.cpp:(.text+0x5a98): = additional relocation overflows omitted from the output clang-3.5: error: linker command failed with exit code 1 (use -v to see = invocation) *** Error code 1 As for enabling optimization, when I use "-DCMAKE_BUILD_TYPE=3DRelease" = or "-DCMAKE_BUILD_TYPE=3DMinSizeRel" with the cmake I get an = "EmitRawText called on an MCStreamer that doesn't support it, something = must not be fully mc'ized" abort. Only "-DCMAKE_BUILD_TYPE=3DDebug" or = "-DCMAKE_BUILD_TYPE=3DNone" seems to work. Maybe I am not enabling the = optimization correctly? I have been able to get ld from binutils 2.24 to mostly work. It will = link binaries with "-static" but dynamic binaries are still a problem. = It seems the default ldscript is not quite right or something. -stacey. On Jul 26, 2014, at 6:46 AM, David Chisnall = wrote: > The only way that I've ever got llvm to compile for MIPS has been by = enabling shared libraries, enabling optimisation, and disabling debug = info. This gave each shared lib a small enough GOT for our binutils = linker to work. >=20 > Newer binutils supports multi-GOT (GOT is split and different GOTs are = installed by some calls) and large-GOT (GOT accesses use register = offsets) modes. >=20 > David >=20 > On 25 Jul 2014, at 23:27, Stacey Son wrote: >=20 >>=20 >> Hi Warner... >>=20 >> On Jul 25, 2014, at 11:26 AM, Warner Losh wrote: >>=20 >>>=20 >>> On Jul 25, 2014, at 9:24 AM, Stacey Son wrote: >>>=20 >>>> Hi all: >>>>=20 >>>> I have been trying to bootstrap clang/llvm 3.5 for mips64 (i.e. = cross build clang/llvm 3.5 for mips64 using clang/llvm 3.5) but run into = the following linker problem (see below) in about the midway point as it = is trying to link 'opt'. The assertions that fail are the following: >>>>=20 >>>> BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail = /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/bin= utils/bfd/elfxx-mips.c:7455 >>>>=20 >>>> BFD_ASSERT (g->assigned_gotno - g->local_gotno >>>> <=3D g->global_gotno); >>>>=20 >>>> BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail = /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/bin= utils/bfd/elfxx-mips.c:2767 >>>>=20 >>>> /* There should have been enough room in the symbol table to >>>> accommodate both the GOT and non-GOT symbols. */ >>>> BFD_ASSERT (hsd.max_non_got_dynindx <=3D hsd.min_got_dynindx); >>>>=20 >>>> BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail = /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/bin= utils/bfd/elfxx-mips.c:10282 >>>>=20 >>>> /* Make sure we didn't grow the global .got region. */ >>>> dynobj =3D elf_hash_table (info)->dynobj; >>>> got =3D mips_elf_got_section (dynobj, FALSE); >>>> g =3D mips_elf_section_data (got)->u.got_info; >>>>=20 >>>> if (g->global_gotsym !=3D NULL) >>>> BFD_ASSERT ((elf_hash_table (info)->dynsymcount >>>> - g->global_gotsym->dynindx) >>>> <=3D g->global_gotno); >>>>=20 >>>> Does anyone have an idea for a work around or fix? >>>=20 >>> Silly question: does using the latest binutils fix this problem? >>=20 >> Is there a stable port of the latest binutils to mips? Does someone = have some patches? I did tried TheRaven's port of the 2.18 binutils but = it seemed that 'ld' wasn't very happy. It didn't like any of the object = files I offered it. >>=20 >>> Failing that, perhaps we need to specify a larger GOT region that we = do today? IIRC, that=92s specified with -g on the linker line, Try = adding =93-G0=94. I have a vague recollection we always used to do this, = but moved it to be a default (or maybe other systems have the default = and we still need to add it). It doesn=92t look like it is being added = from the output that you=92ve posted. IIRC, it has to be specified on = all the compiler invocations as well. >>=20 >> Reading the man page implies -Gvalue/--gpsize=3Dvalue is only for = ECOFF binaries. I tried it anyway and it didn't seem to help. >>=20 >> -stacey. >=20 From owner-freebsd-mips@FreeBSD.ORG Mon Jul 28 14:55:33 2014 Return-Path: Delivered-To: freebsd-mips@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 42232384 for ; Mon, 28 Jul 2014 14:55:33 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2AC1B24D9 for ; Mon, 28 Jul 2014 14:55:33 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.8/8.14.8) with ESMTP id s6SEtX36025874 for ; Mon, 28 Jul 2014 14:55:33 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-mips@FreeBSD.org Subject: [Bug 191587] [mips] 'strip' corrupts static libraries Date: Mon, 28 Jul 2014 14:55:32 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: emaste@freebsd.org X-Bugzilla-Status: Needs Triage X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: freebsd-mips@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:55:33 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191587 --- Comment #12 from Ed Maste --- > We should never strip static libraries should we? > I breaks way more than only mips In the pkg case I encountered it's "strip --strip-debug", which should only be removing debug data, and should be fine for static libraries. -- You are receiving this mail because: You are the assignee for the bug. From owner-freebsd-mips@FreeBSD.ORG Mon Jul 28 15:58:29 2014 Return-Path: Delivered-To: freebsd-mips@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2293599B for ; Mon, 28 Jul 2014 15:58:29 +0000 (UTC) Received: from cdptpa-oedge-vip.email.rr.com (cdptpa-outbound-snat.email.rr.com [107.14.166.231]) by mx1.freebsd.org (Postfix) with ESMTP id D9A422BAF for ; Mon, 28 Jul 2014 15:58:28 +0000 (UTC) Received: from [76.187.139.93] ([76.187.139.93:63832] helo=[192.168.0.30]) by cdptpa-oedge01 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id 17/33-03302-91376D35; Mon, 28 Jul 2014 15:58:18 +0000 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: mips64 ld GOT problem From: Stacey Son In-Reply-To: <37D1F27C-B595-43AA-A0F8-6B48AE4D7C69@FreeBSD.org> Date: Mon, 28 Jul 2014 10:58:16 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: References: <77F1DDA2-A4E5-4D64-AA43-F8CBC55249C4@me.com> <48935A3D-0387-42F1-ACF0-14EB7D8F9A06@bsdimp.com> <2021F70B-2AA4-412C-8D1B-A8D38A3E031C@FreeBSD.org> <37D1F27C-B595-43AA-A0F8-6B48AE4D7C69@FreeBSD.org> To: Stacey Son X-Mailer: Apple Mail (2.1878.6) X-RR-Connecting-IP: 107.14.168.118:25 X-Cloudmark-Score: 0 Cc: David Chisnall , freebsd-mips@FreeBSD.org X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 15:58:29 -0000 OK, I found that if I simply add "-O" to the cmake "-DCMAKE_C_FLAGS" and = "-DCMAKE_CXX_FLAGS" (and setting -DCMAKE_BUILD_TYPE to None) everything = will bootstrap and link. If I am brave enough I may try a "Stage 3" = compile. On Jul 27, 2014, at 2:39 PM, Stacey Son wrote: > Hi David: >=20 > Compiling with the cmake option "-DBUILD_SHARED_LIBS=3DTrue" does get = it pass linking 'opt' but it later fails later on... >=20 > [ 73%] Building CXX object = tools/clang/lib/AST/CMakeFiles/clangAST.dir/VTTBuilder.cpp.o > Linking CXX shared library ../../../../lib/libclangAST.so > [...] > /home/sson/llvm/tools/clang/lib/AST/ASTContext.cpp:(.text+0x710): = relocation truncated to fit: R_MIPS_CALL16 against `bool = llvm::isa(clang::Decl = const* const&)' > [...] > /home/sson/llvm/tools/clang/lib/AST/ASTContext.cpp:(.text+0x5a98): = additional relocation overflows omitted from the output > clang-3.5: error: linker command failed with exit code 1 (use -v to = see invocation) > *** Error code 1 >=20 > As for enabling optimization, when I use "-DCMAKE_BUILD_TYPE=3DRelease" = or "-DCMAKE_BUILD_TYPE=3DMinSizeRel" with the cmake I get an = "EmitRawText called on an MCStreamer that doesn't support it, something = must not be fully mc'ized" abort. Only "-DCMAKE_BUILD_TYPE=3DDebug" or = "-DCMAKE_BUILD_TYPE=3DNone" seems to work. Maybe I am not enabling the = optimization correctly? >=20 > I have been able to get ld from binutils 2.24 to mostly work. It will = link binaries with "-static" but dynamic binaries are still a problem. = It seems the default ldscript is not quite right or something. >=20 > -stacey. >=20 > On Jul 26, 2014, at 6:46 AM, David Chisnall = wrote: >=20 >> The only way that I've ever got llvm to compile for MIPS has been by = enabling shared libraries, enabling optimisation, and disabling debug = info. This gave each shared lib a small enough GOT for our binutils = linker to work. >>=20 >> Newer binutils supports multi-GOT (GOT is split and different GOTs = are installed by some calls) and large-GOT (GOT accesses use register = offsets) modes. >>=20 >> David >>=20 >> On 25 Jul 2014, at 23:27, Stacey Son wrote: >>=20 >>>=20 >>> Hi Warner... >>>=20 >>> On Jul 25, 2014, at 11:26 AM, Warner Losh wrote: >>>=20 >>>>=20 >>>> On Jul 25, 2014, at 9:24 AM, Stacey Son wrote: >>>>=20 >>>>> Hi all: >>>>>=20 >>>>> I have been trying to bootstrap clang/llvm 3.5 for mips64 (i.e. = cross build clang/llvm 3.5 for mips64 using clang/llvm 3.5) but run into = the following linker problem (see below) in about the midway point as it = is trying to link 'opt'. The assertions that fail are the following: >>>>>=20 >>>>> BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail = /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/bin= utils/bfd/elfxx-mips.c:7455 >>>>>=20 >>>>> BFD_ASSERT (g->assigned_gotno - g->local_gotno >>>>> <=3D g->global_gotno); >>>>>=20 >>>>> BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail = /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/bin= utils/bfd/elfxx-mips.c:2767 >>>>>=20 >>>>> /* There should have been enough room in the symbol table to >>>>> accommodate both the GOT and non-GOT symbols. */ >>>>> BFD_ASSERT (hsd.max_non_got_dynindx <=3D hsd.min_got_dynindx); >>>>>=20 >>>>> BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail = /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/bin= utils/bfd/elfxx-mips.c:10282 >>>>>=20 >>>>> /* Make sure we didn't grow the global .got region. */ >>>>> dynobj =3D elf_hash_table (info)->dynobj; >>>>> got =3D mips_elf_got_section (dynobj, FALSE); >>>>> g =3D mips_elf_section_data (got)->u.got_info; >>>>>=20 >>>>> if (g->global_gotsym !=3D NULL) >>>>> BFD_ASSERT ((elf_hash_table (info)->dynsymcount >>>>> - g->global_gotsym->dynindx) >>>>> <=3D g->global_gotno); >>>>>=20 >>>>> Does anyone have an idea for a work around or fix? >>>>=20 >>>> Silly question: does using the latest binutils fix this problem? >>>=20 >>> Is there a stable port of the latest binutils to mips? Does someone = have some patches? I did tried TheRaven's port of the 2.18 binutils but = it seemed that 'ld' wasn't very happy. It didn't like any of the object = files I offered it. >>>=20 >>>> Failing that, perhaps we need to specify a larger GOT region that = we do today? IIRC, that=92s specified with -g on the linker line, Try = adding =93-G0=94. I have a vague recollection we always used to do this, = but moved it to be a default (or maybe other systems have the default = and we still need to add it). It doesn=92t look like it is being added = from the output that you=92ve posted. IIRC, it has to be specified on = all the compiler invocations as well. >>>=20 >>> Reading the man page implies -Gvalue/--gpsize=3Dvalue is only for = ECOFF binaries. I tried it anyway and it didn't seem to help. >>>=20 >>> -stacey. >>=20 >=20 > _______________________________________________ > freebsd-mips@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-mips > To unsubscribe, send any mail to = "freebsd-mips-unsubscribe@freebsd.org" From owner-freebsd-mips@FreeBSD.ORG Tue Jul 29 00:48:35 2014 Return-Path: Delivered-To: freebsd-mips@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 76C9EB1D for ; Tue, 29 Jul 2014 00:48:35 +0000 (UTC) Received: from cdptpa-oedge-vip.email.rr.com (cdptpa-outbound-snat.email.rr.com [107.14.166.232]) by mx1.freebsd.org (Postfix) with ESMTP id 36D5B2AD2 for ; Tue, 29 Jul 2014 00:48:34 +0000 (UTC) Received: from [76.187.139.93] ([76.187.139.93:50641] helo=[192.168.0.30]) by cdptpa-oedge01 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id 12/0C-03302-B5FE6D35; Tue, 29 Jul 2014 00:48:28 +0000 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: mips64 ld GOT problem From: Stacey Son In-Reply-To: Date: Mon, 28 Jul 2014 19:48:26 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <35DBC8E0-45AB-470A-B554-85445FBBF8E4@FreeBSD.org> References: <77F1DDA2-A4E5-4D64-AA43-F8CBC55249C4@me.com> <48935A3D-0387-42F1-ACF0-14EB7D8F9A06@bsdimp.com> <2021F70B-2AA4-412C-8D1B-A8D38A3E031C@FreeBSD.org> <37D1F27C-B595-43AA-A0F8-6B48AE4D7C69@FreeBSD.org> To: freebsd-mips@FreeBSD.org X-Mailer: Apple Mail (2.1878.6) X-RR-Connecting-IP: 107.14.168.118:25 X-Cloudmark-Score: 0 X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 00:48:35 -0000 FWIIW, here is a tarball of my native clang/llvm 3.5.0 bootstrap build = for anyone interested: = http://people.freebsd.org/~sson/mips/clang/clang-3.5.0-r213872.tgz Untar in /usr/local on a mips64 box (in my case an Ubiquiti EdgeRouter = Lite) running -current, set CC, CXX to use clang, clang++ in = /usr/local/clang-3.5.0/bin, and maybe add "-integrated-as" to your = CFLAGS depending on the maturity of your binutils. -stacey. On Jul 28, 2014, at 10:58 AM, Stacey Son wrote: >=20 > OK, I found that if I simply add "-O" to the cmake "-DCMAKE_C_FLAGS" = and "-DCMAKE_CXX_FLAGS" (and setting -DCMAKE_BUILD_TYPE to None) = everything will bootstrap and link. If I am brave enough I may try a = "Stage 3" compile. >=20 >=20 > On Jul 27, 2014, at 2:39 PM, Stacey Son wrote: >=20 >> Hi David: >>=20 >> Compiling with the cmake option "-DBUILD_SHARED_LIBS=3DTrue" does get = it pass linking 'opt' but it later fails later on... >>=20 >> [ 73%] Building CXX object = tools/clang/lib/AST/CMakeFiles/clangAST.dir/VTTBuilder.cpp.o >> Linking CXX shared library ../../../../lib/libclangAST.so >> [...] >> /home/sson/llvm/tools/clang/lib/AST/ASTContext.cpp:(.text+0x710): = relocation truncated to fit: R_MIPS_CALL16 against `bool = llvm::isa(clang::Decl = const* const&)' >> [...] >> /home/sson/llvm/tools/clang/lib/AST/ASTContext.cpp:(.text+0x5a98): = additional relocation overflows omitted from the output >> clang-3.5: error: linker command failed with exit code 1 (use -v to = see invocation) >> *** Error code 1 >>=20 >> As for enabling optimization, when I use "-DCMAKE_BUILD_TYPE=3DRelease"= or "-DCMAKE_BUILD_TYPE=3DMinSizeRel" with the cmake I get an = "EmitRawText called on an MCStreamer that doesn't support it, something = must not be fully mc'ized" abort. Only "-DCMAKE_BUILD_TYPE=3DDebug" or = "-DCMAKE_BUILD_TYPE=3DNone" seems to work. Maybe I am not enabling the = optimization correctly? >>=20 >> I have been able to get ld from binutils 2.24 to mostly work. It = will link binaries with "-static" but dynamic binaries are still a = problem. It seems the default ldscript is not quite right or something. >>=20 >> -stacey. >>=20 >> On Jul 26, 2014, at 6:46 AM, David Chisnall = wrote: >>=20 >>> The only way that I've ever got llvm to compile for MIPS has been by = enabling shared libraries, enabling optimisation, and disabling debug = info. This gave each shared lib a small enough GOT for our binutils = linker to work. >>>=20 >>> Newer binutils supports multi-GOT (GOT is split and different GOTs = are installed by some calls) and large-GOT (GOT accesses use register = offsets) modes. >>>=20 >>> David >>>=20 >>> On 25 Jul 2014, at 23:27, Stacey Son wrote: >>>=20 >>>>=20 >>>> Hi Warner... >>>>=20 >>>> On Jul 25, 2014, at 11:26 AM, Warner Losh wrote: >>>>=20 >>>>>=20 >>>>> On Jul 25, 2014, at 9:24 AM, Stacey Son wrote: >>>>>=20 >>>>>> Hi all: >>>>>>=20 >>>>>> I have been trying to bootstrap clang/llvm 3.5 for mips64 (i.e. = cross build clang/llvm 3.5 for mips64 using clang/llvm 3.5) but run into = the following linker problem (see below) in about the midway point as it = is trying to link 'opt'. The assertions that fail are the following: >>>>>>=20 >>>>>> BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail = /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/bin= utils/bfd/elfxx-mips.c:7455 >>>>>>=20 >>>>>> BFD_ASSERT (g->assigned_gotno - g->local_gotno >>>>>> <=3D g->global_gotno); >>>>>>=20 >>>>>> BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail = /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/bin= utils/bfd/elfxx-mips.c:2767 >>>>>>=20 >>>>>> /* There should have been enough room in the symbol table to >>>>>> accommodate both the GOT and non-GOT symbols. */ >>>>>> BFD_ASSERT (hsd.max_non_got_dynindx <=3D hsd.min_got_dynindx); >>>>>>=20 >>>>>> BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail = /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/bin= utils/bfd/elfxx-mips.c:10282 >>>>>>=20 >>>>>> /* Make sure we didn't grow the global .got region. */ >>>>>> dynobj =3D elf_hash_table (info)->dynobj; >>>>>> got =3D mips_elf_got_section (dynobj, FALSE); >>>>>> g =3D mips_elf_section_data (got)->u.got_info; >>>>>>=20 >>>>>> if (g->global_gotsym !=3D NULL) >>>>>> BFD_ASSERT ((elf_hash_table (info)->dynsymcount >>>>>> - g->global_gotsym->dynindx) >>>>>> <=3D g->global_gotno); >>>>>>=20 >>>>>> Does anyone have an idea for a work around or fix? >>>>>=20 >>>>> Silly question: does using the latest binutils fix this problem? >>>>=20 >>>> Is there a stable port of the latest binutils to mips? Does = someone have some patches? I did tried TheRaven's port of the 2.18 = binutils but it seemed that 'ld' wasn't very happy. It didn't like any = of the object files I offered it. >>>>=20 >>>>> Failing that, perhaps we need to specify a larger GOT region that = we do today? IIRC, that=92s specified with -g on the linker line, Try = adding =93-G0=94. I have a vague recollection we always used to do this, = but moved it to be a default (or maybe other systems have the default = and we still need to add it). It doesn=92t look like it is being added = from the output that you=92ve posted. IIRC, it has to be specified on = all the compiler invocations as well. >>>>=20 >>>> Reading the man page implies -Gvalue/--gpsize=3Dvalue is only for = ECOFF binaries. I tried it anyway and it didn't seem to help. >>>>=20 >>>> -stacey. >>>=20 >>=20 >> _______________________________________________ >> freebsd-mips@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-mips >> To unsubscribe, send any mail to = "freebsd-mips-unsubscribe@freebsd.org" >=20