[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

            Bug ID: 239743
           Summary: Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64
                    with clang
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: [hidden email]
          Reporter: [hidden email]

Created attachment 206395
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=206395&action=edit
patch

With powerpc64 soon switching to clang, it doesn't make sense to use base
ld.bfd when LLD_UNSAFE is defined.

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

Piotr Kubaj <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Individual Port(s)          |Ports Framework
           Assignee|[hidden email]      |[hidden email]
                 CC|                            |[hidden email]
           Severity|Affects Only Me             |Affects Many People

--
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #1 from Antoine Brodin <[hidden email]> ---
(In reply to Piotr Kubaj from comment #0)
The LDFLAGS line doesn't need to be changed.
Also the mis-indentation make me think the patch is wrong.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #2 from Antoine Brodin <[hidden email]> ---
And finally,  I don't understand why powerpc64 needs a special treatment here.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #3 from Antoine Brodin <[hidden email]> ---
You probably want something like this?

%%%
 LDFLAGS+=      -fuse-ld=bfd
 BINARY_ALIAS+= ld=${LD}
 .  if !defined(USE_BINUTILS)
-.    if exists(/usr/bin/ld.bfd)
+.    if exists(/usr/bin/ld.bfd) && (${ARCH} != powerpc64 || ${OSVERSION} <
1300038)
 LD=    /usr/bin/ld.bfd
 CONFIGURE_ENV+=        LD=${LD}
 MAKE_ENV+=     LD=${LD}
%%%

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #4 from Piotr Kubaj <[hidden email]> ---
(In reply to Antoine Brodin from comment #3)
I'll test this patch later and confirm whether it's ok.

Regarding why powerpc64 needs special treatment:
when it switches to clang, ld.bfd will still be installed. The reason is that
lld currently doesn't support linking powerpc (32-bit) binaries. We will use
lld for 64-bit binaries, however.

So even after the switch /usr/bin/ld.bfd will still be installed (until lld is
able to link powerpc binaries).

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #5 from Piotr Kubaj <[hidden email]> ---
(In reply to Piotr Kubaj from comment #4)
This is still not enough (my patch works). misc/e2fsprogs-libuuid fails to
configure:
   1187 configure:3325: cc -O2 -pipe  -fstack-protector-strong
-fno-strict-aliasing -std=gnu99
-I/tmp/usr/ports/misc/e2fsprogs-libuuid/work/e2fsprogs-1.45.3/lib
-I/usr/local/include
  -fstack-protector-strong -fuse-ld=bfd  conftest.c  >&5
   1188 /usr/bin/ld.bfd: Dwarf Error: found dwarf version '4', this reader only
handles version 2 information.
   1189 /usr/lib/crt1.o: In function `_start':
   1190 crt1.c:(.text+0x2): undefined reference to `.TOC.'

The reason is that ld.bfd is used, which doesn't even know about elfv2. We need
to either use lld (which works for this port on CURRENT but not on
12.0-RELEASE/amd64) or ld.bfd from ports. Since -fuse-ld allows for passing the
whole patch to the linker, this is what we must do.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #6 from Piotr Kubaj <[hidden email]> ---
Relevant base review: https://reviews.freebsd.org/D20261

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #7 from Piotr Kubaj <[hidden email]> ---
(In reply to Antoine Brodin from comment #3)
This patch is ok and much simpler:
Index: Mk/bsd.port.mk
===================================================================
--- Mk/bsd.port.mk      (revision 508433)
+++ Mk/bsd.port.mk      (working copy)
@@ -1820,10 +1820,10 @@
 .endif

 .if defined(LLD_UNSAFE) && ${/usr/bin/ld:L:tA} == /usr/bin/ld.lld
-LDFLAGS+=      -fuse-ld=bfd
+LDFLAGS+=      -fuse-ld=${LD}
 BINARY_ALIAS+= ld=${LD}
 .  if !defined(USE_BINUTILS)
-.    if exists(/usr/bin/ld.bfd)
+.    if exists(/usr/bin/ld.bfd) && (${ARCH} != powerpc64 || ${OSVERSION} <
1300038)
 LD=    /usr/bin/ld.bfd
 CONFIGURE_ENV+=        LD=${LD}
 MAKE_ENV+=     LD=${LD}

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #8 from Antoine Brodin <[hidden email]> ---
(In reply to Piotr Kubaj from comment #7)
gcc doesn't understand this syntax

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #9 from Piotr Kubaj <[hidden email]> ---
(In reply to Antoine Brodin from comment #8)
This is not about GCC, powerpc64 switches to Clang (both 32-bit and 64-bit).
The problem is with LLD which can't link ppc32 binaries, that's why GNU ld
needs to be used.

So 32-bit binaries will be compiled by Clang and linked by GNU ld.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #10 from Antoine Brodin <[hidden email]> ---
(In reply to Piotr Kubaj from comment #9)
Sure, but the ports tree is not just powerpc64 and some ports are compiled with
gcc even on amd64 or i386

Does this patch work?

%%%
 LDFLAGS+=      -fuse-ld=bfd
 BINARY_ALIAS+= ld=${LD}
 .  if !defined(USE_BINUTILS)
-.    if exists(/usr/bin/ld.bfd)
+.    if exists(/usr/bin/ld.bfd) && (${ARCH} != powerpc64 || ${OSVERSION} <
1300038)
 LD=    /usr/bin/ld.bfd
 CONFIGURE_ENV+=        LD=${LD}
 MAKE_ENV+=     LD=${LD}
 .    else
+BINARY_ALIAS+= ld.bfd=${LOCALBASE}/bin/ld.bfd
 USE_BINUTILS=  yes
 .    endif
 .  endif
%%%

The first patch you proposed (
https://bugs.freebsd.org/bugzilla/attachment.cgi?id=206395 ) was breaking ports
on amd64 / i386 / aarch64 btw.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #11 from Piotr Kubaj <[hidden email]> ---
(In reply to Antoine Brodin from comment #10)
No, it still fails with the same error:
   1187 configure:3325: cc -O2 -pipe  -fstack-protector-strong
-fno-strict-aliasing -std=gnu99
-I/tmp/usr/ports/misc/e2fsprogs-libuuid/work/e2fsprogs-1.45.3/lib
-I/usr/local/include
  -fstack-protector-strong -fuse-ld=bfd  conftest.c  >&5
   1188 /usr/bin/ld.bfd: Dwarf Error: found dwarf version '4', this reader only
handles version 2 information.
   1189 /usr/lib/crt1.o: In function `_start':
   1190 crt1.c:(.text+0x2): undefined reference to `.TOC.'
   1191 /usr/bin/ld.bfd: /usr/lib/crt1.o: unknown relocation type 252 for
symbol .TOC.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #12 from Piotr Kubaj <[hidden email]> ---
Note that since powerpc64 currently still use gcc in head, this PR is just to
agree on a proper patch. Once we have a proper patch, this PR should wait until
the switch to clang.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

Jan Beich <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #206395|0                           |1
        is obsolete|                            |
                 CC|                            |[hidden email]

--- Comment #13 from Jan Beich <[hidden email]> ---
Created attachment 206411
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=206411&action=edit
patch

Antoine, does this work for you? It worked for pkubaj@. I'm not sure if my
commit message/inline comment are correct, though.

- Only one extra conditional (easy to understand)
- Comment why there (easy to refactor)
- Drop OSVERSION to avoid redundancy with ld == lld conditional
- Add -B${LOCALBASE}/bin because USE_BINUTILS alone doesn't

(In reply to Piotr Kubaj from comment #4)
> Regarding why powerpc64 needs special treatment:
> when it switches to clang, ld.bfd will still be installed.
> The reason is that lld currently doesn't support linking powerpc (32-bit) binaries.
> We will use lld for 64-bit binaries, however.

Do you mean -m64 uses ELFv2 while -m32 uses ELFv1? If so either review D20261
or review D20383 needs to make Clang default to BFD linker when -m32 is passed
e.g., via getDefaultLinker().

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #14 from Antoine Brodin <[hidden email]> ---
(In reply to Jan Beich from comment #13)
If it works on powerpc64,  it's less intrusive for other archs.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #15 from Piotr Kubaj <[hidden email]> ---
(In reply to Jan Beich from comment #13)
There's no ELFv1 and ELFv2 for powerpc. powerpc has only one ABI and that
doesn't change with the switch to Clang. ELFv2 is only defined for powerpc64.

Regarding using GNU ld by default in Clang, I passed your suggestion to
bdragon@, who currently leads the effort of switching to Clang, he said he
would look at it.

Since there's no OSVERSION check, I think this patch is ok to be committed now.
OK?

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #16 from Piotr Kubaj <[hidden email]> ---
Can we get this patch to ports? I'd like it to be committed before the switch
to clang is done, so that we don't get new breakages.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #17 from Piotr Kubaj <[hidden email]> ---
Following our recent discussion on #powerpc64, is there any more information
you need?

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 239743] Mk/bsd.port.mk: don't switch to ld.bfd on powerpc64 with clang

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239743

--- Comment #18 from Jan Beich <[hidden email]> ---
I'm not on portmgr, so cannot approve. comment 14 can *probably* be treated as
portmgr approval.

When to land is up to you. Maybe adjust code comments and commit message if my
understanding is incorrect/incomplete.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "[hidden email]"
12