Re: UPDATE: LLVM - Fix building on arm

2020-11-03 Thread Brad Smith

On 11/3/2020 3:37 PM, Jeremie Courreges-Anglas wrote:

On Tue, Nov 03 2020, Brad Smith  wrote:

The following diff fixes building the LLVM port on arm.

http://build-failures.rhaalovely.net/arm/2020-06-03/devel/llvm,,-main.log

Is it supposed to fix this error?  What was the problem?



Yes, to resolve that issue.


revision 1.133
date: 2017/02/16 15:07:16;  author: jca;  state: Exp;  lines: +8 -3;  
commitid: ZCMIOK4N5VLJOUXb;

Use -mlong-calls on arm and powerpc to work around relocations overflow

On those architectures the .text section of the executables is too big
for the 32M immediate branch offset.  ld --relax is supposed to fix
things on powerpc, but it is actually ineffective here.  cc -mlong-calls
creates branches instructions using a full 32 bits register; FreeBSD
uses the same workaround.

A fix for lib/csu is still needed to avoid an overflow between .init
and .fini sections.  powerpc hasn't been tested, but we know that
devel/llvm is already broken there anyway.

ok Brad (maintainer)


But I don't remember ever seeing any arm packages and that was before
switching to Clang and then lld as defaults.

The PowerPC part was eventually removed as it did not work.


revision 1.203
date: 2019/01/04 00:14:57;  author: jca;  state: Exp;  lines: +2 -4;  
commitid: Xwd6ogyWHrLM99NH;

Stop using -mlongcall on powerpc

Using long calls means slower code.  It is not useful right now because
the size of the llvm executables has been reduced, as shown by tests by
Charlene Wendling.  And it breaks compilation with gcc 6, as pointed out
by a report from George Koehler.




UPDATE: LLVM - Fix building on arm

2020-11-03 Thread Brad Smith
The following diff fixes building the LLVM port on arm.

pickles$ make install
===>  Verifying specs: c++ c++abi pthread c edit m pthread z
===>  found c++.5.0 c++abi.3.0 pthread.26.1 c.96.0 edit.5.2 m.10.1 z.5.0
===>  Installing llvm-10.0.1p3 from /usr/ports/packages/arm/all/
llvm-10.0.1p3: ok
New and changed readme(s):
/usr/local/share/doc/pkg-readmes/llvm
pickles$ /usr/local/bin/clang --version
clang version 10.0.1
Target: arm-unknown-openbsd6.8
Thread model: posix
InstalledDir: /usr/local/bin



Index: Makefile
===
RCS file: /home/cvs/ports/devel/llvm/Makefile,v
retrieving revision 1.263
diff -u -p -u -p -r1.263 Makefile
--- Makefile4 Sep 2020 09:55:35 -   1.263
+++ Makefile3 Nov 2020 17:48:10 -
@@ -109,10 +109,7 @@ CXXFLAGS +=-fno-ret-protector
 CXXFLAGS +=-mno-retpoline
 .endif
 
-.if ${MACHINE_ARCH} == "arm"
-CFLAGS +=  -mlong-calls
-CXXFLAGS +=-mlong-calls
-.elif ${MACHINE_ARCH} == "powerpc"
+.if ${MACHINE_ARCH} == "powerpc"
 CONFIGURE_ARGS +=  -DCMAKE_EXE_LINKER_FLAGS="-Wl,-relax"
 CONFIGURE_ARGS +=  -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-relax"
 .endif



Re: UPDATE: LLVM - Fix building on arm

2020-11-03 Thread Jeremie Courreges-Anglas
On Tue, Nov 03 2020, Brad Smith  wrote:
> On 11/3/2020 3:37 PM, Jeremie Courreges-Anglas wrote:
>> On Tue, Nov 03 2020, Brad Smith  wrote:
>>> The following diff fixes building the LLVM port on arm.
>> http://build-failures.rhaalovely.net/arm/2020-06-03/devel/llvm,,-main.log
>>
>> Is it supposed to fix this error?  What was the problem?
>
>
> Yes, to resolve that issue.

So what was the problem in the cmake error log?  What helped you
understand and solve this issue?

Thanks for the diff, I'm going to commit it anyway since it looks like
removing -mlongcall fixed powerpc too but... oh well.

> 
> revision 1.133
> date: 2017/02/16 15:07:16;  author: jca;  state: Exp;  lines: +8 -3; 
> commitid: ZCMIOK4N5VLJOUXb;
> Use -mlong-calls on arm and powerpc to work around relocations overflow
>
> On those architectures the .text section of the executables is too big
> for the 32M immediate branch offset.  ld --relax is supposed to fix
> things on powerpc, but it is actually ineffective here.  cc -mlong-calls
> creates branches instructions using a full 32 bits register; FreeBSD
> uses the same workaround.
>
> A fix for lib/csu is still needed to avoid an overflow between .init
> and .fini sections.  powerpc hasn't been tested, but we know that
> devel/llvm is already broken there anyway.
>
> ok Brad (maintainer)
> 
>
> But I don't remember ever seeing any arm packages

Well I highly suspect I actually tested that fix on the cubox machine
I had around at that time.

Looking at the arm bulk build reports,

bulk build on armv7-0.ports.openbsd.org
started on  Thu Feb 2 13:04:20 MST 2017
finished at Sat Feb 11 01:55:20 MST 2017
lasted 09D05h51m
done with kern.version=OpenBSD 6.0-current (GENERIC) #36: Tue Jan 31 00:42:23 
MST 2017

llvm fails

bulk build on armv7-0.ports.openbsd.org
started on  Wed Mar 1 15:05:08 MST 2017
finished at Sat Mar 11 07:33:24 MST 2017
lasted 10D09h28m
done with kern.version=OpenBSD 6.0-current (GENERIC) #53: Tue Feb 28 05:50:54 
MST 2017

no llvm failure

> and that was before
> switching to Clang and then lld as defaults.

Granted.

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: UPDATE: LLVM - Fix building on arm

2020-11-03 Thread Jeremie Courreges-Anglas
On Tue, Nov 03 2020, Brad Smith  wrote:
> The following diff fixes building the LLVM port on arm.

http://build-failures.rhaalovely.net/arm/2020-06-03/devel/llvm,,-main.log

Is it supposed to fix this error?  What was the problem?

> pickles$ make install
> ===>  Verifying specs: c++ c++abi pthread c edit m pthread z
> ===>  found c++.5.0 c++abi.3.0 pthread.26.1 c.96.0 edit.5.2 m.10.1 z.5.0
> ===>  Installing llvm-10.0.1p3 from /usr/ports/packages/arm/all/
> llvm-10.0.1p3: ok
> New and changed readme(s):
> /usr/local/share/doc/pkg-readmes/llvm
> pickles$ /usr/local/bin/clang --version
> clang version 10.0.1
> Target: arm-unknown-openbsd6.8
> Thread model: posix
> InstalledDir: /usr/local/bin
>
>
> Index: Makefile
> ===
> RCS file: /home/cvs/ports/devel/llvm/Makefile,v
> retrieving revision 1.263
> diff -u -p -u -p -r1.263 Makefile
> --- Makefile  4 Sep 2020 09:55:35 -   1.263
> +++ Makefile  3 Nov 2020 17:48:10 -
> @@ -109,10 +109,7 @@ CXXFLAGS +=  -fno-ret-protector
>  CXXFLAGS +=  -mno-retpoline
>  .endif
>  
> -.if ${MACHINE_ARCH} == "arm"
> -CFLAGS +=-mlong-calls
> -CXXFLAGS +=  -mlong-calls
> -.elif ${MACHINE_ARCH} == "powerpc"
> +.if ${MACHINE_ARCH} == "powerpc"
>  CONFIGURE_ARGS +=-DCMAKE_EXE_LINKER_FLAGS="-Wl,-relax"
>  CONFIGURE_ARGS +=-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-relax"
>  .endif
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE