From owner-freebsd-ports@freebsd.org Sat Nov 17 02:49:46 2018 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93F48112111F for ; Sat, 17 Nov 2018 02:49:46 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic310-15.consmr.mail.bf2.yahoo.com (sonic310-15.consmr.mail.bf2.yahoo.com [74.6.135.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFE52761FD for ; Sat, 17 Nov 2018 02:49:45 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: KoJ2xn0VM1m53zvL17fVNbK4VV2ZAqTtlVnwkV.K2n4__9ottzRzgkn2sVqZAOc mYzsXjzae3QkmIoqRYGDZ37ofHTwM..bZyscwPH8qzD7OKZAMe4NDNTgbSXGw5co7dWtQ09aEehB 71SKb1vDxvQOwM_fb53pWvUDMpHObVzESVFhTUt6hfbcv0gzoVLwyaFTIJRXo0rf3JFrEr_KmJTq JgKqk5E3cqTw7Qx15tMYJYpPOvj7KFVQgq3MRn71sYxAKxizbxd5mPCnNQ4KlWwAHMwAYCKlQxqi xK7EFqfCGZKyF.m9dnKHzn_78ievf4jKNePpzhJeSYCt0LEbQdSY1S6LYtt_Yt4TzjYHnzthuM1e 3mBKHInY5Nxc0Y45EsJ40Q7WrllkehFrsK9x.qHilg19Fe3mwRBn83rcOx_oeH7IOMslm0LqePcL 09KDJgFFAr0SeZZIjXvIJS03kFjFkdMhxG131HWqCyl2zQ3wCYoeGWOYl.Mvf59Fkn9TXNovnkpW 5ESuUjDyUc0bfkrPD5wSbeU2PtUTLdyEM8cf8am3KwsYBkEIOZEvmAsBnGfuYtMyc6JCi4xjtyoo itgHDy7..3k8CEWpbgma9hXSol30dSwX55oQSjMoFSXC9sFbOsifJikwQ.wPOrEQMI64PCNdPyVi 9LNVOL9SuekgD5iCKhggnRrqG6iCPEdyH6ybSybH2s9z0vx2AeKSuMTC6.4wbHrZ10jDbSzwwE3X tZ3lIPURUcOOMYMqPfF_tL0wbncWjTiLcykSG3RP_eYoPaWW8J11Bpg5J0Rd7T6O7i9J5LFXAUso l5E3zObqvpmBkicZ1M74HUBOyMXMy1xy2H05xT49B0MxzZt8yeo5JjvPDCHf483xil_hIIOTPIGy VF1fWvB77z8c35lu7Q3R6s8JtN_hL2dFbMxJMBHYzWkSeI8IrnG7WNVA.kP1uIx.s0Ou2b_6KGiX 7JmYS68W9.NjYMvOuGtHFAKJERCbRz05QcLreQbEWCEnY8ByMmOfnjIVF4Z29r7mt.xP7y6kKJkq W87FmSqGsDZ39HLLLs_qtyaYGtrQ7mAZ.NYUKr9Orzd2z0o_s2q5jRWSS Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.bf2.yahoo.com with HTTP; Sat, 17 Nov 2018 02:49:44 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.25]) ([76.115.7.162]) by smtp416.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 90d98a03c778a6fcc556a7c02e5e0f41; Sat, 17 Nov 2018 02:49:42 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.1 \(3445.101.1\)) Subject: Re: ports head -r487783: on armv7 x11/pixman fails to build: /usr/bin/ld: error: can't create dynamic relocation R_ARM_V4BX against local symbol in readonly segment; recompile object files with -fPIC From: Mark Millard In-Reply-To: <908FD96A-9F8F-4477-8E2F-2C97D49AF35E@yahoo.com> Date: Fri, 16 Nov 2018 18:49:40 -0800 Cc: ports-list freebsd Content-Transfer-Encoding: quoted-printable Message-Id: References: <03FFE5BB-777D-40D3-9AA3-C8C359BE1F2B@yahoo.com> <908FD96A-9F8F-4477-8E2F-2C97D49AF35E@yahoo.com> To: Jan Beich X-Mailer: Apple Mail (2.3445.101.1) X-Rspamd-Queue-Id: AFE52761FD X-Spamd-Result: default: False [1.42 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_FROM(0.00)[yahoo.com]; NEURAL_SPAM_SHORT(0.94)[0.937,0]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; RCVD_IN_DNSWL_NONE(0.00)[125.135.6.74.list.dnswl.org : 127.0.5.0]; RCPT_COUNT_TWO(0.00)[2]; IP_SCORE(0.99)[ip: (1.15), ipnet: 74.6.128.0/21(2.16), asn: 26101(1.73), country: US(-0.10)]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:26101, ipnet:74.6.128.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Nov 2018 02:49:46 -0000 On 2018-Nov-16, at 18:15, Mark Millard wrote: >=20 > I finally figured out parts of the issue, I think. > At least how the V_ARM_V4BX use is getting there > despite lld's status for handling it . . . >=20 > On armv7: >=20 > # more test_bx_lr.S > .text > .arch armv6 > .object_arch armv4 > .arm > .altmacro > .p2align 2 > .func fname > .global fname > .hidden fname > .type fname, %function > fname: > bx lr >=20 > (I got those lines from the failing port's .S files, > including includes. Note the .object_arch armv4 use > and the forced armv6, not armv7.) For reference relative to the use of .object_arch armv4 : # grep -r object_arch = /wrkdirs/usr/ports/x11/pixman/work/pixman-0.34.0/pixman/ | more = /wrkdirs/usr/ports/x11/pixman/work/pixman-0.34.0/pixman/pixman-arm-neon-as= m.S: .object_arch armv4 = /wrkdirs/usr/ports/x11/pixman/work/pixman-0.34.0/pixman/pixman-arm-simd-as= m-scaled.S: .object_arch armv4 = /wrkdirs/usr/ports/x11/pixman/work/pixman-0.34.0/pixman/pixman-arm-neon-as= m-bilinear.S:.object_arch armv4 = /wrkdirs/usr/ports/x11/pixman/work/pixman-0.34.0/pixman/pixman-arm-simd-as= m.S: .object_arch armv4 Without .object_arch armv4 the assembler involved does not output the V_ARM_V4BX *ABS* relocation records (adjusted the small example): # objdump -x test_bx_lr.o | more test_bx_lr.o: file format elf32-littlearm test_bx_lr.o architecture: arm, flags 0x00000010: HAS_SYMS start address 0x00000000 private flags =3D 5000000: [Version5 EABI] Sections: Idx Name Size VMA LMA File off Algn 0 .text 00000004 00000000 00000000 00000034 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .data 00000000 00000000 00000000 00000038 2**0 CONTENTS, ALLOC, LOAD, DATA 2 .bss 00000000 00000000 00000000 00000038 2**0 ALLOC 3 .ARM.attributes 0000001b 00000000 00000000 00000038 2**0 CONTENTS, READONLY SYMBOL TABLE: 00000000 l d .text 00000000 .text 00000000 l d .data 00000000 .data 00000000 l d .bss 00000000 .bss 00000000 l d .ARM.attributes 00000000 .ARM.attributes 00000000 g F .text 00000000 .hidden fname > # clang -target armv7-unknown-freebsd13.0-gnueabihf -O -pipe = -no-integrated-as -MT test_bx_lr.lo -MD -MP -MF test_bx_lr.Tpo -c = test_bx_lr.S -fPIC -DPIC -o test_bx_lr.o >=20 > (The -target is not necessary. I just choose to be explicit.) >=20 > # objdump -x test_bx_lr.o | more >=20 > test_bx_lr.o: file format elf32-littlearm > test_bx_lr.o > architecture: armv4, flags 0x00000011: > HAS_RELOC, HAS_SYMS > start address 0x00000000 > private flags =3D 5000000: [Version5 EABI] >=20 > Sections: > Idx Name Size VMA LMA File off Algn > 0 .text 00000004 00000000 00000000 00000034 2**2 > CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE > 1 .data 00000000 00000000 00000000 00000038 2**0 > CONTENTS, ALLOC, LOAD, DATA > 2 .bss 00000000 00000000 00000000 00000038 2**0 > ALLOC > 3 .ARM.attributes 0000001b 00000000 00000000 00000038 2**0 > CONTENTS, READONLY > SYMBOL TABLE: > 00000000 l d .text 00000000 .text > 00000000 l d .data 00000000 .data > 00000000 l d .bss 00000000 .bss > 00000000 l d .ARM.attributes 00000000 .ARM.attributes > 00000000 g F .text 00000000 .hidden fname >=20 >=20 > RELOCATION RECORDS FOR [.text]: > OFFSET TYPE VALUE=20 > 00000000 R_ARM_V4BX *ABS* >=20 >=20 > truss for that cc command reports looking in many > places for as, finally finding /usr/local/bin/as : >=20 > access("/usr/bin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK) = ERR#2 'No such file or directory' > access("/usr/bin/as",X_OK|R_OK) ERR#2 'No such = file or directory' >=20 > (Note: based on WITHOUT_BINUTILS=3D for buildworld the above would = normally > not be found. But for WITH_BINUTILS=3D the host as would be found.) >=20 > access("/sbin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK) ERR#2 = 'No such file or directory' > access("/bin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK) ERR#2 = 'No such file or directory' > access("/usr/sbin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK) = ERR#2 'No such file or directory' > access("/usr/bin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK) = ERR#2 'No such file or directory' > = access("/usr/local/sbin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK)= ERR#2 'No such file or directory' > = access("/usr/local/bin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK) = ERR#2 'No such file or directory' > = access("/usr/home/markmi/bin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|= R_OK) ERR#2 'No such file or directory' > access("/sbin/as",X_OK|R_OK) ERR#2 'No such file or = directory' > access("/bin/as",X_OK|R_OK) ERR#2 'No such file or = directory' > access("/usr/sbin/as",X_OK|R_OK) ERR#2 'No such file or = directory' > access("/usr/bin/as",X_OK|R_OK) ERR#2 'No such = file or directory' > access("/usr/local/sbin/as",X_OK|R_OK) ERR#2 'No such = file or directory' > access("/usr/local/bin/as",X_OK|R_OK) =3D 0 (0x0) >=20 > (Note the /usr/home/markmi/bin/armv7-unknown-freebsd13.0-gnueabihf-as = attempt > before the one actually found and used. I would not have guessed the > need to worry about such a place.) >=20 > Then follows: >=20 > fstatat(AT_FDCWD,"/usr/local/bin/as",{ mode=3D-r-xr-xr-x = ,inode=3D80287,size=3D21817416,blksize=3D32768 },0x0) =3D 0 (0x0) > __sysctl(0xbfbfe020,0x2,0xbfbfe018,0xbfbfe01c,0xe,0x236c9140) =3D 0 = (0x0) > access("/usr/bin/clang",F_OK) =3D 0 (0x0) > vfork() =3D 61461 = (0xf015) > wait4(61461,{ EXITED,val=3D0 },0x0,0x0) =3D 61461 = (0xf015) > access("/usr/local/bin/as",F_OK) =3D 0 (0x0) > vfork() =3D 61462 = (0xf016) > wait4(61462,{ EXITED,val=3D0 },0x0,0x0) =3D 61462 = (0xf016) > access("/tmp/test_bx_lr-0c7bf8.s",W_OK) =3D 0 (0x0) > fstatat(AT_FDCWD,"/tmp/test_bx_lr-0c7bf8.s",{ mode=3D-rw-r--r-- = ,inode=3D802647,size=3D210,blksize=3D32768 },0x0) =3D 0 (0x0) > fstatat(AT_FDCWD,"/tmp/test_bx_lr-0c7bf8.s",{ mode=3D-rw-r--r-- = ,inode=3D802647,size=3D210,blksize=3D32768 },AT_SYMLINK_NOFOLLOW) =3D 0 = (0x0) > fstatat(AT_FDCWD,"/tmp/test_bx_lr-0c7bf8.s",{ mode=3D-rw-r--r-- = ,inode=3D802647,size=3D210,blksize=3D32768 },AT_SYMLINK_NOFOLLOW) =3D 0 = (0x0) > unlink("/tmp/test_bx_lr-0c7bf8.s") =3D 0 (0x0) >=20 > llvm/clang is not providing the assembler used for -no-integrated-as . > This would appear to imply that a system without ports or other such > can not use -no-integrated-as with clang for buildworld buildkernel. >=20 > In my normal armv7 command line context the above ends up using: >=20 > # /usr/local/bin/as -v > GNU assembler version 2.30 (armv7-portbld-freebsd13.0) using BFD = version (GNU Binutils) 2.30 >=20 > So a GNU toolchain's as is actually in control of what goes in > the .o file in many contexts. It is not clear that all the > alternatives are equivalent for R_ARM_V4BX being generated > or not. >=20 >=20 > Simplifying the command (but still showing target): >=20 > # clang -target armv7-unknown-freebsd13.0-gnueabihf -pipe = -no-integrated-as -c test_bx_lr.S -o test_bx_lr.o >=20 > # objdump -x test_bx_lr.o | more >=20 > test_bx_lr.o: file format elf32-littlearm > test_bx_lr.o > architecture: armv4, flags 0x00000011: > HAS_RELOC, HAS_SYMS > start address 0x00000000 > private flags =3D 5000000: [Version5 EABI] >=20 > Sections: > Idx Name Size VMA LMA File off Algn > 0 .text 00000004 00000000 00000000 00000034 2**2 > CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE > 1 .data 00000000 00000000 00000000 00000038 2**0 > CONTENTS, ALLOC, LOAD, DATA > 2 .bss 00000000 00000000 00000000 00000038 2**0 > ALLOC > 3 .ARM.attributes 0000001b 00000000 00000000 00000038 2**0 > CONTENTS, READONLY > SYMBOL TABLE: > 00000000 l d .text 00000000 .text > 00000000 l d .data 00000000 .data > 00000000 l d .bss 00000000 .bss > 00000000 l d .ARM.attributes 00000000 .ARM.attributes > 00000000 g F .text 00000000 .hidden fname >=20 >=20 > RELOCATION RECORDS FOR [.text]: > OFFSET TYPE VALUE=20 > 00000000 R_ARM_V4BX *ABS* >=20 >=20 > Without the -no-integrated-as the notation in the file is rejected, > with "unknown directive" for .func . >=20 >=20 >=20 > Using poudriere bulk with -i and installing binutils in the > session, I see the same inside my amd64->armv7 cross build > environment. So there still is the question of how R_ARM_V4BX > is handled by various lld's in various contexts. (Or whatever > linker is being used if it is not lld.) >=20 > Back to amd64 land . . . >=20 > Renaming the existing as files so we can see all the places > searched before not-found is declared (on amd64 with -target > specified): >=20 > access("/usr/bin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK) = ERR#2 'No such file or directory' > access("/usr/bin/as",X_OK|R_OK) ERR#2 'No such = file or directory' > access("/usr/bin/x86_64-unknown-freebsd13.0-as",X_OK|R_OK) ERR#2 'No = such file or directory' > access("/sbin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK) ERR#2 = 'No such file or directory' > access("/bin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK) ERR#2 = 'No such file or directory' > access("/usr/sbin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK) = ERR#2 'No such file or directory' > access("/usr/bin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK) = ERR#2 'No such file or directory' > = access("/usr/local/sbin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK)= ERR#2 'No such file or directory' > = access("/usr/local/bin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|R_OK) = ERR#2 'No such file or directory' > = access("/usr/home/markmi/bin/armv7-unknown-freebsd13.0-gnueabihf-as",X_OK|= R_OK) ERR#2 'No such file or directory' > access("/sbin/as",X_OK|R_OK) ERR#2 'No such file or = directory' > access("/bin/as",X_OK|R_OK) ERR#2 'No such file or = directory' > access("/usr/sbin/as",X_OK|R_OK) ERR#2 'No such file or = directory' > access("/usr/bin/as",X_OK|R_OK) ERR#2 'No such = file or directory' > access("/usr/local/sbin/as",X_OK|R_OK) ERR#2 'No such = file or directory' > access("/usr/local/bin/as",X_OK|R_OK) ERR#2 'No such file or = directory' > access("/usr/home/markmi/bin/as",X_OK|R_OK) ERR#2 'No such file or = directory' > access("/sbin/x86_64-unknown-freebsd13.0-as",X_OK|R_OK) ERR#2 'No such = file or directory' > access("/bin/x86_64-unknown-freebsd13.0-as",X_OK|R_OK) ERR#2 'No such = file or directory' > access("/usr/sbin/x86_64-unknown-freebsd13.0-as",X_OK|R_OK) ERR#2 'No = such file or directory' > access("/usr/bin/x86_64-unknown-freebsd13.0-as",X_OK|R_OK) ERR#2 'No = such file or directory' > access("/usr/local/sbin/x86_64-unknown-freebsd13.0-as",X_OK|R_OK) = ERR#2 'No such file or directory' > access("/usr/local/bin/x86_64-unknown-freebsd13.0-as",X_OK|R_OK) ERR#2 = 'No such file or directory' > access("/usr/home/markmi/bin/x86_64-unknown-freebsd13.0-as",X_OK|R_OK) = ERR#2 'No such file or directory' >=20 > (Note: It actually explicitly tries to use the x86_64 assembler if it > does not find an armv7 or a generically pathed one. The generically > pathed ones would normally also be x86_64 ones.) >=20 >=20 > Another thing of note (using aarch64 as an example): >=20 > /usr/local/aarch64-unknown-freebsd13.0/bin/as >=20 > does not appear to be someplace that clang would find as > but is a place devel/aarch64-binutils puts one. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)