Summary: | base/gcc: and base/binutils -r424540 for TARGET_ARCH=powerpc64 example: file placement and gcc/g++ internal file lookups do not match so gcc/g++ do not work | ||
---|---|---|---|
Product: | Ports & Packages | Reporter: | Mark Millard <marklmi26-fbsd> |
Component: | Individual Port(s) | Assignee: | freebsd-toolchain (Nobody) <toolchain> |
Status: | Closed Overcome By Events | ||
Severity: | Affects Only Me | CC: | lwhsu, swills |
Priority: | --- | ||
Version: | Latest | ||
Hardware: | Any | ||
OS: | Any | ||
See Also: | https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224217 |
Description
Mark Millard
2016-11-10 18:39:37 UTC
I think this is resolved by the changes in bug 224217. Please confirm. (In reply to Steve Wills from comment #1) This will have to wait for experiments on a powerpc64 after having installed what base/binutils and base/gcc built, probably needing to uninstall the likes of devel/binutils and devel/powerpc64-gcc first. For example: base/binutils vs. devel/powerpc64-binutils vs. base/gcc vs. devel/powerpc64-gcc 3 of the 4 use powerpc64-unknown-freebsd12.0- prefixes but devel/powerpc64-binutils uses powerpc64-freebsd- prefixes. (Or did last I built it on a powerpc64.) There are the /usr/bin/ vs. /usr/local/bin/ sorts of path differences as well so the matching names for devel/powerpc64-gcc and base/gcc make for ties to path order. (In reply to Mark Millard from comment #2) I did not get to this before losing access to the powerpc family members for what will likely be weeks/months(?). Sorry. [My FreeBSD time has been very limited in recent months compared prior recent years.] (In reply to Steve Wills from comment #1) To test I used a chroot and I did "make package" for base/gcc6 and then installed it (inside the chroot). This was without involving base/binutils before or after that. It did involve: # make build-depends-list /usr/ports/ports-mgmt/pkg /usr/ports/devel/gmake /usr/ports/print/texinfo and what they indirectly require. (The run-depends-list was empty.) So, for example, the system linker is lld for this powerpc64 context. The result of attempting to compile/link main.c was: # cc -std=c99 -pedantic main.c ld: error: unable to find library -lgcc ld: error: unable to find library -lgcc_s ld: error: unable to find library -lc ld: error: unable to find library -lgcc ld: error: unable to find library -lgcc_s collect2: error: ld returned 1 exit status The linker ld (really lld) is found and used but other things are not. So: # truss -a -f -o output cc -std=c99 -pedantic main.c ld: error: unable to find library -lgcc ld: error: unable to find library -lgcc_s ld: error: unable to find library -lc ld: error: unable to find library -lgcc ld: error: unable to find library -lgcc_s collect2: error: ld returned 1 exit status And using libgcc_s as an example: # grep libgcc_s output | more 96678: open("/lib/libgcc_s.so.1",O_RDONLY|O_CLOEXEC|O_VERIFY,02005070032) = 3 (0x3) 96679: open("/lib/libgcc_s.so.1",O_RDONLY|O_CLOEXEC|O_VERIFY,02114270032) = 3 (0x3) 96681: open("/lib/libgcc_s.so.1",O_RDONLY|O_CLOEXEC|O_VERIFY,02003670032) = 3 (0x3) 96682: open("/lib/libgcc_s.so.1",O_RDONLY|O_CLOEXEC|O_VERIFY,02171470032) = 3 (0x3) 96682: access("/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0/libgcc_s.so",F_OK) ERR#2 'No such file or directory' 96682: access("/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0/libgcc_s.a",F_OK) ERR#2 'No such file or directory' 96682: access("/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0/libgcc_s.so",F_OK) ERR#2 'No such file or directory' 96682: access("/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0/libgcc_s.a",F_OK) ERR#2 'No such file or directory' It turns out that: 96679 is for: "/usr/libexec/gcc/powerpc64-unknown-freebsd13.0/6.5.0/cc1", "-quiet", "main.c", "-quiet", "-dumpbase", "main.c", "-auxbase", "main", "-Wpedantic", "-std=c99", "-o", "/tmp//cczJu591.s" 96681 is for: "/usr/libexec/gcc/powerpc64-unknown-freebsd13.0/6.5.0/collect2", "--sysroot=/", "--eh-frame-hdr", "-melf64ppc_fbsd", "-dynamic-linker", "/libexec/ld-elf.so.1", "/usr/lib/crt1.o", "/usr/lib/crti.o", "/usr/lib/crtbegin.o", "-L/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0", "/tmp//ccabilZp.o", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "-lc", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "/usr/lib/crtend.o", "/usr/lib/crtn.o" Note the -L/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0 Note the lack of some form of -L/lib 96682 is for: "/usr/bin/ld", "--sysroot=/", "--eh-frame-hdr", "-melf64ppc_fbsd", "-dynamic-linker", "/libexec/ld-elf.so.1", "/usr/lib/crt1.o", "/usr/lib/crti.o", "/usr/lib/crtbegin.o", "-L/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0", "/tmp//ccabilZp.o", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "-lc", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "/usr/lib/crtend.o", "/usr/lib/crtn.o" Note the -L/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0 Note the lack of some form of -L/lib Note that: 96682: open("/lib/libgcc_s.so.1",O_RDONLY|O_CLOEXEC|O_VERIFY,02171470032) = 3 (0x3) is for lld itself being bound to the library, not for the linking of main. The linker (lld) is looking in the wrong places for various libraries --but based on what it has been told on its command line. For reference: # find /lib*/ /usr/lib*/ -name "libgcc_s*" -print | more /lib/libgcc_s.so.1 /usr/lib/debug/lib/libgcc_s.so.1.debug /usr/lib/debug/usr/lib32/libgcc_s.so.1.debug /usr/lib/libgcc_s.so /usr/lib32/libgcc_s.so.1 /usr/lib32/libgcc_s.so Context notes: The context is head -r538510 based, with ports based on -r526539 . (In reply to Mark Millard from comment #4) Adding a side note: With the clang conversion as it is, FreeBSD switched from -msvr4-struct-return to -maix-struct-return for powerpc64. gcc by default is still -msvr4-struct-return for powerpc64. If ABI compatibility is the primary criteria, it is not obvious to me which side changes but one should. Without ABI compatibility, base/gcc*'s may be irrelevant for powerpc64. https://reviews.llvm.org/D73290 is a review for changing the clang side (restoring the historical FreeBSD ABI behavior on the specific issue). But the review has had no activity after late 2020-Jan. The change might make the claim "OpenPOWER ELF V2 ABI" odd in that it does not match linux (but does match embedded or whatever the terminology was). (The OpenPower ABI is a case analysis, not uniform.) (I tested and reported. But it would not be for me to declare such is the FreeBSD direction. I am actually still using the change in order to allow safely mixing gcc and clang materials in non-kernel areas.) (In reply to Mark Millard from comment #5) I forgot to mention needing to patch the pkg-plist and its handling for powerpc64. See below. I presumed that 64-bit would include 32-bit (lib32) but FreeBSD can be built without lib32 support. # svnlite diff /usr/ports/base/ Index: /usr/ports/base/binutils/Makefile =================================================================== --- /usr/ports/base/binutils/Makefile (revision 526539) +++ /usr/ports/base/binutils/Makefile (working copy) @@ -86,11 +86,17 @@ .else PLIST_SUB+= MIPS="@comment " .endif +.if ${ARCH} == "powerpc64" +PLIST_SUB+= POWERPC64="" +PLIST_SUB+= POWERPC="" +.else +PLIST_SUB+= POWERPC64="@comment " .if ${ARCH:Mpowerpc*} PLIST_SUB+= POWERPC="" .else PLIST_SUB+= POWERPC="@comment " .endif +.endif .if ${ARCH:Msparc*} PLIST_SUB+= SPARC="" .else Index: /usr/ports/base/binutils/pkg-plist =================================================================== --- /usr/ports/base/binutils/pkg-plist (revision 526539) +++ /usr/ports/base/binutils/pkg-plist (working copy) @@ -494,32 +494,32 @@ %%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf32ppc.xsw %%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf32ppc.xu %%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf32ppc.xw -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.x -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xbn -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xc -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xd -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xdc -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xdw -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xn -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xr -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xs -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xsc -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xsw -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xu -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xw -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc.x -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xbn -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xc -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xd -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xdc -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xdw -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xn -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xr -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xs -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xsc -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xsw -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xu -%%POWERPC%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xw +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.x +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xbn +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xc +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xd +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xdc +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xdw +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xn +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xr +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xs +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xsc +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xsw +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xu +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc_fbsd.xw +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc.x +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xbn +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xc +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xd +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xdc +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xdw +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xn +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xr +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xs +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xsc +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xsw +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xu +%%POWERPC64%%%%BUTARGET%%/lib/ldscripts/elf64ppc.xw %%SPARC%%%%BUTARGET%%/lib/ldscripts/elf32_sparc.x %%SPARC%%%%BUTARGET%%/lib/ldscripts/elf32_sparc.xbn %%SPARC%%%%BUTARGET%%/lib/ldscripts/elf32_sparc.xc Ports' main no longer has base/ nor does the latest quarterly. Older quarterly has base but is likely unused. |