Re: [PATCH]: BUILD link to lib atomic on ARM

2020-03-15 Thread David CARLIER
Ok here a slightly modified version, the regex did not work. Regards.

On Sun, 15 Mar 2020 at 20:21, Willy Tarreau  wrote:

> Hi David!
>
> On Sun, Mar 15, 2020 at 01:55:33PM +, David CARLIER wrote:
> > Yes surely I had only a raspberry at hand arm64 surely needs too.
> > change of approaches.
>
> (...)
>
> --- a/Makefile
> +++ b/Makefile
> @@ -328,6 +328,12 @@ ifeq ($(TARGET),linux-glibc)
>  USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_FUTEX USE_LINUX_TPROXY
> \
>  USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_NS
> USE_TFO \
>  USE_GETADDRINFO USE_BACKTRACE)
> +  ifneq ($(findstring arm,$(shell uname -m)),)
> +TARGET_LDFLAGS=-latomic
> +  endif
> +  ifneq ($(findstring aarch64,$(shell uname -m)),)
> +TARGET_LDFLAGS=-latomic
> +  endif
>  endif
>
> Please no, not like this, it is wrong. Instead of testing the target, it
> tests the build machine, which is not necessarily related, especially in
> the ARM world where cross-compilation prevails due to the much slower
> machines.
>
> This would fail in both directions:
>   - it will not correctly add -latomic if I build on my PC for one of
> my ARM machines ;
>
>   - it will incorrectly append -latomic if I build from ARM for my PC.
>
> Instead what needs to be tested is the compiler's default target.
>
> There are two ways to do it properly, which are very close to each other:
>
>   - either you emit all the compiler's pre-defined macros and search for
> your choosen target there:
>
> $(CC) -E -dM -xc - 
> (not very clean since technically it could match anywhere)
>
>   - or better, you verify that __aarch64__ equals 1 on this compiler:
>
> echo __aarch64__ | $(CC) -E -xc - | grep -q ^1
>
> When you want to test if any value within a set is set, you can even
> do it by testing that a string made of their concatenation changes:
>
> echo __arm__/__aarch64__ | $(CC) -E -xc - | grep -q __arm__/__aarch64__
>
> If it returns a success, it means that neither define is not set in the
> compiler.
>
> So your patch can then be changed to roughly this to simply let "make"
> check the output:
>
> +  ifneq ($(shell echo __arm__/__aarch64__ | $(CC) -E -xc - | grep
> '^[^#]'),__arm__/__aarch64__)
> +TARGET_LDFLAGS=-latomic
> +  endif
>
> Cheers,
> Willy
>


0001-BUILD-on-ARM-must-be-linked-to-libatomic.patch
Description: Binary data


Re: [PATCH]: BUILD link to lib atomic on ARM

2020-03-15 Thread Willy Tarreau
Hi David!

On Sun, Mar 15, 2020 at 01:55:33PM +, David CARLIER wrote:
> Yes surely I had only a raspberry at hand arm64 surely needs too.
> change of approaches.

(...)

--- a/Makefile
+++ b/Makefile
@@ -328,6 +328,12 @@ ifeq ($(TARGET),linux-glibc)
 USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_FUTEX USE_LINUX_TPROXY  \
 USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_NS USE_TFO \
 USE_GETADDRINFO USE_BACKTRACE)
+  ifneq ($(findstring arm,$(shell uname -m)),)
+TARGET_LDFLAGS=-latomic
+  endif
+  ifneq ($(findstring aarch64,$(shell uname -m)),)
+TARGET_LDFLAGS=-latomic
+  endif
 endif

Please no, not like this, it is wrong. Instead of testing the target, it
tests the build machine, which is not necessarily related, especially in
the ARM world where cross-compilation prevails due to the much slower
machines.

This would fail in both directions:
  - it will not correctly add -latomic if I build on my PC for one of
my ARM machines ;

  - it will incorrectly append -latomic if I build from ARM for my PC.

Instead what needs to be tested is the compiler's default target.

There are two ways to do it properly, which are very close to each other:

  - either you emit all the compiler's pre-defined macros and search for
your choosen target there:

$(CC) -E -dM -xc - 

Re: [PATCH]: BUILD link to lib atomic on ARM

2020-03-15 Thread Илья Шипицин
before your patch, ldd on arm64 shows

/usr/bin/ld: src/ev_poll.o(.debug_info+0x78): R_AARCH64_ABS64 used
with TLS symbol poll_events

/usr/bin/ld: src/ev_poll.o(.debug_info+0xe3): R_AARCH64_ABS64 used
with TLS symbol nbfd

/usr/bin/ld: src/ev_epoll.o(.debug_info+0x66): R_AARCH64_ABS64 used
with TLS symbol epoll_events

/usr/bin/ld: src/hlua.o(.debug_info+0x19f): R_AARCH64_ABS64 used with
TLS symbol safe_ljmp_env


https://travis-ci.com/github/haproxy/haproxy/jobs/297635546



is it something we should be aware of ?

does your patch fix it :) ?




вс, 15 мар. 2020 г. в 18:58, David CARLIER :

> Yes surely I had only a raspberry at hand arm64 surely needs too.
> change of approaches.
>
>
> On Sun, 15 Mar 2020 at 13:39, Martin Grigorov 
> wrote:
>
>> Hi David,
>>
>> On my ARM64 VM `uname -m` returns:
>> $ uname -m
>> aarch64
>>
>> Should your change take 'aarch64' into account as well ?
>>
>> Martin
>>
>> On Sun, Mar 15, 2020 at 3:34 PM David CARLIER  wrote:
>>
>>> Oups sorry I really forgot :-)
>>>
>>> On Sun, 15 Mar 2020 at 13:32, Martin Grigorov 
>>> wrote:
>>>
 Hi

 On Sun, Mar 15, 2020 at 3:03 PM Aleksandar Lazic 
 wrote:

> On 15.03.20 11:33, David CARLIER wrote:
> > Hi
> >
> > Here a little patch proposal to fix build on ARM.
> >
> > Regards.
>
> Ähm, maybe my mail client hide the Patch because I can't see it ;-)?
>

 It seems David forgot to attach it or the attachment didn't make it for
 other reason. I also don't see it.

 Martin


>
> Regards
> Aleks
>
>


Re: [PATCH]: BUILD link to lib atomic on ARM

2020-03-15 Thread David CARLIER
Yes surely I had only a raspberry at hand arm64 surely needs too.
change of approaches.


On Sun, 15 Mar 2020 at 13:39, Martin Grigorov  wrote:

> Hi David,
>
> On my ARM64 VM `uname -m` returns:
> $ uname -m
> aarch64
>
> Should your change take 'aarch64' into account as well ?
>
> Martin
>
> On Sun, Mar 15, 2020 at 3:34 PM David CARLIER  wrote:
>
>> Oups sorry I really forgot :-)
>>
>> On Sun, 15 Mar 2020 at 13:32, Martin Grigorov 
>> wrote:
>>
>>> Hi
>>>
>>> On Sun, Mar 15, 2020 at 3:03 PM Aleksandar Lazic 
>>> wrote:
>>>
 On 15.03.20 11:33, David CARLIER wrote:
 > Hi
 >
 > Here a little patch proposal to fix build on ARM.
 >
 > Regards.

 Ähm, maybe my mail client hide the Patch because I can't see it ;-)?

>>>
>>> It seems David forgot to attach it or the attachment didn't make it for
>>> other reason. I also don't see it.
>>>
>>> Martin
>>>
>>>

 Regards
 Aleks




0001-BUILD-on-ARM-must-be-linked-to-libatomic.patch
Description: Binary data


Re: [PATCH]: BUILD link to lib atomic on ARM

2020-03-15 Thread Martin Grigorov
Hi David,

On my ARM64 VM `uname -m` returns:
$ uname -m
aarch64

Should your change take 'aarch64' into account as well ?

Martin

On Sun, Mar 15, 2020 at 3:34 PM David CARLIER  wrote:

> Oups sorry I really forgot :-)
>
> On Sun, 15 Mar 2020 at 13:32, Martin Grigorov 
> wrote:
>
>> Hi
>>
>> On Sun, Mar 15, 2020 at 3:03 PM Aleksandar Lazic 
>> wrote:
>>
>>> On 15.03.20 11:33, David CARLIER wrote:
>>> > Hi
>>> >
>>> > Here a little patch proposal to fix build on ARM.
>>> >
>>> > Regards.
>>>
>>> Ähm, maybe my mail client hide the Patch because I can't see it ;-)?
>>>
>>
>> It seems David forgot to attach it or the attachment didn't make it for
>> other reason. I also don't see it.
>>
>> Martin
>>
>>
>>>
>>> Regards
>>> Aleks
>>>
>>>


Re: [PATCH]: BUILD link to lib atomic on ARM

2020-03-15 Thread David CARLIER
Oups sorry I really forgot :-)

On Sun, 15 Mar 2020 at 13:32, Martin Grigorov  wrote:

> Hi
>
> On Sun, Mar 15, 2020 at 3:03 PM Aleksandar Lazic 
> wrote:
>
>> On 15.03.20 11:33, David CARLIER wrote:
>> > Hi
>> >
>> > Here a little patch proposal to fix build on ARM.
>> >
>> > Regards.
>>
>> Ähm, maybe my mail client hide the Patch because I can't see it ;-)?
>>
>
> It seems David forgot to attach it or the attachment didn't make it for
> other reason. I also don't see it.
>
> Martin
>
>
>>
>> Regards
>> Aleks
>>
>>


0001-BUILD-on-ARM-must-be-linked-to-libatomic.patch
Description: Binary data


Re: [PATCH]: BUILD link to lib atomic on ARM

2020-03-15 Thread Martin Grigorov
Hi

On Sun, Mar 15, 2020 at 3:03 PM Aleksandar Lazic  wrote:

> On 15.03.20 11:33, David CARLIER wrote:
> > Hi
> >
> > Here a little patch proposal to fix build on ARM.
> >
> > Regards.
>
> Ähm, maybe my mail client hide the Patch because I can't see it ;-)?
>

It seems David forgot to attach it or the attachment didn't make it for
other reason. I also don't see it.

Martin


>
> Regards
> Aleks
>
>


Re: [PATCH]: BUILD link to lib atomic on ARM

2020-03-15 Thread Aleksandar Lazic

On 15.03.20 11:33, David CARLIER wrote:

Hi

Here a little patch proposal to fix build on ARM.

Regards.


Ähm, maybe my mail client hide the Patch because I can't see it ;-)?

Regards
Aleks



[PATCH]: BUILD link to lib atomic on ARM

2020-03-15 Thread David CARLIER
Hi

Here a little patch proposal to fix build on ARM.

Regards.