mailing list of musl libc
 help / color / mirror / code / Atom feed
* shmctl not found when compiling compiler-rt
@ 2018-02-13 13:34 Dmitry Golovin
  2018-02-13 14:15 ` Szabolcs Nagy
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Golovin @ 2018-02-13 13:34 UTC (permalink / raw)
  To: musl

Hi!

I'm trying to compile compiler-rt with musl and it used to be fine, but I can't succeed with recent versions of compiler-rt.

The compilation fails because of the lack of real_shmctl while musl clearly has shmctl: http://git.musl-libc.org/cgit/musl/tree/src/ipc/shmctl.c

Here is the complete output:

    llvm/projects/compiler-rt/lib/msan/msan_interceptors.cc:1446:15: error: no member named 'real_shmctl' in namespace '__interception'; did you mean 'real_ioctl'?
        int res = REAL(shmctl)(shmid, shmctl_ipc_stat, &ds);
                  ^~~~~~~~~~~~
    llvm/projects/compiler-rt/lib/msan/../interception/interception.h:162:34: note: expanded from macro 'REAL'
    # define REAL(x) __interception::PTR_TO_REAL(x)
                     ~~~~~~~~~~~~~~~~^
    llvm/projects/compiler-rt/lib/msan/../interception/interception.h:161:25: note: expanded from macro 'PTR_TO_REAL'
    # define PTR_TO_REAL(x) real_##x
                            ^
    <scratch space>:70:1: note: expanded from here
    real_shmctl
    ^
    llvm/projects/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:1706:1: note: 'real_ioctl' declared here
    INTERCEPTOR(int, ioctl, int d, unsigned long request, ...) {
    ^
    llvm/projects/compiler-rt/lib/msan/../interception/interception.h:213:3: note: expanded from macro 'INTERCEPTOR'
      DEFINE_REAL(ret_type, func, __VA_ARGS__) \
      ^
    llvm/projects/compiler-rt/lib/msan/../interception/interception.h:194:23: note: expanded from macro 'DEFINE_REAL'
          FUNC_TYPE(func) PTR_TO_REAL(func); \
                          ^
    llvm/projects/compiler-rt/lib/msan/../interception/interception.h:161:25: note: expanded from macro 'PTR_TO_REAL'
    # define PTR_TO_REAL(x) real_##x
                            ^
    <scratch space>:108:1: note: expanded from here
    real_ioctl
    ^

Can you please help me to understand why is it not compiling and how to make it compile again?

To compile without glibc on linux using this patch:
https://github.com/tpimh/ngtc/blob/alpine/patch/compiler-rt-01-sanitizer-nongnu.patch

Regards,
Dmitry


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: shmctl not found when compiling compiler-rt
  2018-02-13 13:34 shmctl not found when compiling compiler-rt Dmitry Golovin
@ 2018-02-13 14:15 ` Szabolcs Nagy
  2018-02-13 14:30   ` Matúš Olekšák
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Szabolcs Nagy @ 2018-02-13 14:15 UTC (permalink / raw)
  To: musl

* Dmitry Golovin <dima@golovin.in> [2018-02-13 15:34:34 +0200]:
> I'm trying to compile compiler-rt with musl and it used to be fine, but I can't succeed with recent versions of compiler-rt.
> 
> The compilation fails because of the lack of real_shmctl while musl clearly has shmctl: http://git.musl-libc.org/cgit/musl/tree/src/ipc/shmctl.c
> 
> Here is the complete output:
> 
>     llvm/projects/compiler-rt/lib/msan/msan_interceptors.cc:1446:15: error: no member named 'real_shmctl' in namespace '__interception'; did you mean 'real_ioctl'?
>         int res = REAL(shmctl)(shmid, shmctl_ipc_stat, &ds);
>                   ^~~~~~~~~~~~

there should be a

DECLARE_REAL(int, shmctl, int shmid, int cmd, void *buf)

in that file which defines __interception::real_shmctl.

> To compile without glibc on linux using this patch:
> https://github.com/tpimh/ngtc/blob/alpine/patch/compiler-rt-01-sanitizer-nongnu.patch
> 
> Regards,
> Dmitry


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: shmctl not found when compiling compiler-rt
  2018-02-13 14:15 ` Szabolcs Nagy
@ 2018-02-13 14:30   ` Matúš Olekšák
  2018-02-13 14:33     ` Szabolcs Nagy
  2018-02-13 14:33     ` Dmitry Golovin
  2018-02-13 16:32   ` Julien Ramseier
  2018-02-14 15:29   ` Dmitry Golovin
  2 siblings, 2 replies; 9+ messages in thread
From: Matúš Olekšák @ 2018-02-13 14:30 UTC (permalink / raw)
  To: musl


[-- Attachment #1.1: Type: text/plain, Size: 1099 bytes --]

Try this patch to correctly link compiler-rt.

2018-02-13 15:15 GMT+01:00 Szabolcs Nagy <nsz@port70.net>:

> * Dmitry Golovin <dima@golovin.in> [2018-02-13 15:34:34 +0200]:
> > I'm trying to compile compiler-rt with musl and it used to be fine, but
> I can't succeed with recent versions of compiler-rt.
> >
> > The compilation fails because of the lack of real_shmctl while musl
> clearly has shmctl: http://git.musl-libc.org/cgit/
> musl/tree/src/ipc/shmctl.c
> >
> > Here is the complete output:
> >
> >     llvm/projects/compiler-rt/lib/msan/msan_interceptors.cc:1446:15:
> error: no member named 'real_shmctl' in namespace '__interception'; did you
> mean 'real_ioctl'?
> >         int res = REAL(shmctl)(shmid, shmctl_ipc_stat, &ds);
> >                   ^~~~~~~~~~~~
>
> there should be a
>
> DECLARE_REAL(int, shmctl, int shmid, int cmd, void *buf)
>
> in that file which defines __interception::real_shmctl.
>
> > To compile without glibc on linux using this patch:
> > https://github.com/tpimh/ngtc/blob/alpine/patch/compiler-rt-
> 01-sanitizer-nongnu.patch
> >
> > Regards,
> > Dmitry
>

[-- Attachment #1.2: Type: text/html, Size: 1913 bytes --]

[-- Attachment #2: compiler-rt.patch --]
[-- Type: application/octet-stream, Size: 519 bytes --]

--- a/configure
+++ b/configure
@@ -597,7 +597,8 @@
 
 # Find compiler runtime library
 test -z "$LIBCC" && tryldflag LIBCC -lgcc && tryldflag LIBCC -lgcc_eh
-test -z "$LIBCC" && tryldflag LIBCC -lcompiler_rt
+test -z "$LIBCC" && try_libcc=`$CC -print-libgcc-file-name 2>/dev/null` \
+                 && tryldflag LIBCC "$try_libcc"
 test -z "$LIBCC" && try_libcc=`$CC -print-file-name=libpcc.a 2>/dev/null` \
                  && tryldflag LIBCC "$try_libcc"
 printf "using compiler runtime libraries: %s\n" "$LIBCC"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: shmctl not found when compiling compiler-rt
  2018-02-13 14:30   ` Matúš Olekšák
@ 2018-02-13 14:33     ` Szabolcs Nagy
  2018-02-13 14:33     ` Dmitry Golovin
  1 sibling, 0 replies; 9+ messages in thread
From: Szabolcs Nagy @ 2018-02-13 14:33 UTC (permalink / raw)
  To: musl

* Matúš Olekšák <oleksak.matus@gmail.com> [2018-02-13 15:30:45 +0100]:
> Try this patch to correctly link compiler-rt.
> 

why would a linker flag change fix a compile time issue?

> 2018-02-13 15:15 GMT+01:00 Szabolcs Nagy <nsz@port70.net>:
> 
> > * Dmitry Golovin <dima@golovin.in> [2018-02-13 15:34:34 +0200]:
> > > I'm trying to compile compiler-rt with musl and it used to be fine, but
> > I can't succeed with recent versions of compiler-rt.
> > >
> > > The compilation fails because of the lack of real_shmctl while musl
> > clearly has shmctl: http://git.musl-libc.org/cgit/
> > musl/tree/src/ipc/shmctl.c
> > >
> > > Here is the complete output:
> > >
> > >     llvm/projects/compiler-rt/lib/msan/msan_interceptors.cc:1446:15:
> > error: no member named 'real_shmctl' in namespace '__interception'; did you
> > mean 'real_ioctl'?
> > >         int res = REAL(shmctl)(shmid, shmctl_ipc_stat, &ds);
> > >                   ^~~~~~~~~~~~
> >
> > there should be a
> >
> > DECLARE_REAL(int, shmctl, int shmid, int cmd, void *buf)
> >
> > in that file which defines __interception::real_shmctl.
> >
> > > To compile without glibc on linux using this patch:
> > > https://github.com/tpimh/ngtc/blob/alpine/patch/compiler-rt-
> > 01-sanitizer-nongnu.patch
> > >
> > > Regards,
> > > Dmitry
> >




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: shmctl not found when compiling compiler-rt
  2018-02-13 14:30   ` Matúš Olekšák
  2018-02-13 14:33     ` Szabolcs Nagy
@ 2018-02-13 14:33     ` Dmitry Golovin
  2018-02-13 14:36       ` Matúš Olekšák
  1 sibling, 1 reply; 9+ messages in thread
From: Dmitry Golovin @ 2018-02-13 14:33 UTC (permalink / raw)
  To: musl

Thank you for the patch, but I don't think it is relevant to this problem.

If you take a look at my build script, you'll see that I don't need it: https://github.com/tpimh/ngtc/blob/alpine/build.sh#L73

Regards,
Dmitry

13.02.2018, 16:31, "Matúš Olekšák" <oleksak.matus@gmail.com>:
> Try this patch to correctly link compiler-rt.
>
> 2018-02-13 15:15 GMT+01:00 Szabolcs Nagy <nsz@port70.net>:
>> * Dmitry Golovin <dima@golovin.in> [2018-02-13 15:34:34 +0200]:
>>> I'm trying to compile compiler-rt with musl and it used to be fine, but I can't succeed with recent versions of compiler-rt.
>>>
>>> The compilation fails because of the lack of real_shmctl while musl clearly has shmctl: http://git.musl-libc.org/cgit/musl/tree/src/ipc/shmctl.c
>>>
>>> Here is the complete output:
>>>
>>>     llvm/projects/compiler-rt/lib/msan/msan_interceptors.cc:1446:15: error: no member named 'real_shmctl' in namespace '__interception'; did you mean 'real_ioctl'?
>>>         int res = REAL(shmctl)(shmid, shmctl_ipc_stat, &ds);
>>>                   ^~~~~~~~~~~~
>>
>> there should be a
>>
>> DECLARE_REAL(int, shmctl, int shmid, int cmd, void *buf)
>>
>> in that file which defines __interception::real_shmctl.
>>
>>> To compile without glibc on linux using this patch:
>>> https://github.com/tpimh/ngtc/blob/alpine/patch/compiler-rt-01-sanitizer-nongnu.patch
>>>
>>> Regards,
>>> Dmitry


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: shmctl not found when compiling compiler-rt
  2018-02-13 14:33     ` Dmitry Golovin
@ 2018-02-13 14:36       ` Matúš Olekšák
  2018-02-13 14:51         ` Matúš Olekšák
  0 siblings, 1 reply; 9+ messages in thread
From: Matúš Olekšák @ 2018-02-13 14:36 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1714 bytes --]

I assumed it's the same problem a had last week on pure llvm environment
and I discovered bug in compiler-rt detection which solves my patch.

2018-02-13 15:33 GMT+01:00 Dmitry Golovin <dima@golovin.in>:

> Thank you for the patch, but I don't think it is relevant to this problem.
>
> If you take a look at my build script, you'll see that I don't need it:
> https://github.com/tpimh/ngtc/blob/alpine/build.sh#L73
>
> Regards,
> Dmitry
>
> 13.02.2018, 16:31, "Matúš Olekšák" <oleksak.matus@gmail.com>:
> > Try this patch to correctly link compiler-rt.
> >
> > 2018-02-13 15:15 GMT+01:00 Szabolcs Nagy <nsz@port70.net>:
> >> * Dmitry Golovin <dima@golovin.in> [2018-02-13 15:34:34 +0200]:
> >>> I'm trying to compile compiler-rt with musl and it used to be fine,
> but I can't succeed with recent versions of compiler-rt.
> >>>
> >>> The compilation fails because of the lack of real_shmctl while musl
> clearly has shmctl: http://git.musl-libc.org/cgit/
> musl/tree/src/ipc/shmctl.c
> >>>
> >>> Here is the complete output:
> >>>
> >>>     llvm/projects/compiler-rt/lib/msan/msan_interceptors.cc:1446:15:
> error: no member named 'real_shmctl' in namespace '__interception'; did you
> mean 'real_ioctl'?
> >>>         int res = REAL(shmctl)(shmid, shmctl_ipc_stat, &ds);
> >>>                   ^~~~~~~~~~~~
> >>
> >> there should be a
> >>
> >> DECLARE_REAL(int, shmctl, int shmid, int cmd, void *buf)
> >>
> >> in that file which defines __interception::real_shmctl.
> >>
> >>> To compile without glibc on linux using this patch:
> >>> https://github.com/tpimh/ngtc/blob/alpine/patch/compiler-rt-
> 01-sanitizer-nongnu.patch
> >>>
> >>> Regards,
> >>> Dmitry
>

[-- Attachment #2: Type: text/html, Size: 2858 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: shmctl not found when compiling compiler-rt
  2018-02-13 14:36       ` Matúš Olekšák
@ 2018-02-13 14:51         ` Matúš Olekšák
  0 siblings, 0 replies; 9+ messages in thread
From: Matúš Olekšák @ 2018-02-13 14:51 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 2007 bytes --]

Oh, now I read it again and I realize you try to compile compiler-rt and
not musl. I'm so sorry for misunderstanding. I had a rough day.

PS: Sorry for spam

2018-02-13 15:36 GMT+01:00 Matúš Olekšák <oleksak.matus@gmail.com>:

> I assumed it's the same problem a had last week on pure llvm environment
> and I discovered bug in compiler-rt detection which solves my patch.
>
> 2018-02-13 15:33 GMT+01:00 Dmitry Golovin <dima@golovin.in>:
>
>> Thank you for the patch, but I don't think it is relevant to this problem.
>>
>> If you take a look at my build script, you'll see that I don't need it:
>> https://github.com/tpimh/ngtc/blob/alpine/build.sh#L73
>>
>> Regards,
>> Dmitry
>>
>> 13.02.2018, 16:31, "Matúš Olekšák" <oleksak.matus@gmail.com>:
>> > Try this patch to correctly link compiler-rt.
>> >
>> > 2018-02-13 15:15 GMT+01:00 Szabolcs Nagy <nsz@port70.net>:
>> >> * Dmitry Golovin <dima@golovin.in> [2018-02-13 15:34:34 +0200]:
>> >>> I'm trying to compile compiler-rt with musl and it used to be fine,
>> but I can't succeed with recent versions of compiler-rt.
>> >>>
>> >>> The compilation fails because of the lack of real_shmctl while musl
>> clearly has shmctl: http://git.musl-libc.org/cgit/
>> musl/tree/src/ipc/shmctl.c
>> >>>
>> >>> Here is the complete output:
>> >>>
>> >>>     llvm/projects/compiler-rt/lib/msan/msan_interceptors.cc:1446:15:
>> error: no member named 'real_shmctl' in namespace '__interception'; did you
>> mean 'real_ioctl'?
>> >>>         int res = REAL(shmctl)(shmid, shmctl_ipc_stat, &ds);
>> >>>                   ^~~~~~~~~~~~
>> >>
>> >> there should be a
>> >>
>> >> DECLARE_REAL(int, shmctl, int shmid, int cmd, void *buf)
>> >>
>> >> in that file which defines __interception::real_shmctl.
>> >>
>> >>> To compile without glibc on linux using this patch:
>> >>> https://github.com/tpimh/ngtc/blob/alpine/patch/compiler-rt-
>> 01-sanitizer-nongnu.patch
>> >>>
>> >>> Regards,
>> >>> Dmitry
>>
>
>

[-- Attachment #2: Type: text/html, Size: 3553 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: shmctl not found when compiling compiler-rt
  2018-02-13 14:15 ` Szabolcs Nagy
  2018-02-13 14:30   ` Matúš Olekšák
@ 2018-02-13 16:32   ` Julien Ramseier
  2018-02-14 15:29   ` Dmitry Golovin
  2 siblings, 0 replies; 9+ messages in thread
From: Julien Ramseier @ 2018-02-13 16:32 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]



> Le 13 févr. 2018 à 15:15, Szabolcs Nagy <nsz@port70.net> a écrit :
> 
> * Dmitry Golovin <dima@golovin.in> [2018-02-13 15:34:34 +0200]:
>> I'm trying to compile compiler-rt with musl and it used to be fine, but I can't succeed with recent versions of compiler-rt.
>> 
>> The compilation fails because of the lack of real_shmctl while musl clearly has shmctl: http://git.musl-libc.org/cgit/musl/tree/src/ipc/shmctl.c
>> 
>> Here is the complete output:
>> 
>>    llvm/projects/compiler-rt/lib/msan/msan_interceptors.cc:1446:15: error: no member named 'real_shmctl' in namespace '__interception'; did you mean 'real_ioctl'?
>>        int res = REAL(shmctl)(shmid, shmctl_ipc_stat, &ds);
>>                  ^~~~~~~~~~~~
> 
> there should be a
> 
> DECLARE_REAL(int, shmctl, int shmid, int cmd, void *buf)
> 
> in that file which defines __interception::real_shmctl.
> 

The DECLARE_REAL was removed in https://reviews.llvm.org/D40766 <https://reviews.llvm.org/D40766>.
Though I didn't understand why.


[-- Attachment #2: Type: text/html, Size: 2041 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: shmctl not found when compiling compiler-rt
  2018-02-13 14:15 ` Szabolcs Nagy
  2018-02-13 14:30   ` Matúš Olekšák
  2018-02-13 16:32   ` Julien Ramseier
@ 2018-02-14 15:29   ` Dmitry Golovin
  2 siblings, 0 replies; 9+ messages in thread
From: Dmitry Golovin @ 2018-02-14 15:29 UTC (permalink / raw)
  To: musl

Thank you!

DECLARE_REAL worked. It seems it was there, but was removed later: https://github.com/llvm-mirror/compiler-rt/commit/d4f4f7cd131af547f3d94219c1f486534fec2e60#diff-22e90027e43e7a82412a4f97c22b86e6L1137

But it seems that it is declared also here: https://github.com/llvm-mirror/compiler-rt/blob/master/lib/sanitizer_common/sanitizer_common_interceptors.inc#L4320 

So, probably the problem is that SANITIZER_INTERCEPT_SHMCTL is not enabled for some reason. I will investigate it and change the patch accordingly.

Thank you once again for your help!

Regards,
Dmitry

13.02.2018, 16:15, "Szabolcs Nagy" <nsz@port70.net>:
> * Dmitry Golovin <dima@golovin.in> [2018-02-13 15:34:34 +0200]:
>>  I'm trying to compile compiler-rt with musl and it used to be fine, but I can't succeed with recent versions of compiler-rt.
>>
>>  The compilation fails because of the lack of real_shmctl while musl clearly has shmctl: http://git.musl-libc.org/cgit/musl/tree/src/ipc/shmctl.c
>>
>>  Here is the complete output:
>>
>>      llvm/projects/compiler-rt/lib/msan/msan_interceptors.cc:1446:15: error: no member named 'real_shmctl' in namespace '__interception'; did you mean 'real_ioctl'?
>>          int res = REAL(shmctl)(shmid, shmctl_ipc_stat, &ds);
>>                    ^~~~~~~~~~~~
>
> there should be a
>
> DECLARE_REAL(int, shmctl, int shmid, int cmd, void *buf)
>
> in that file which defines __interception::real_shmctl.
>
>>  To compile without glibc on linux using this patch:
>>  https://github.com/tpimh/ngtc/blob/alpine/patch/compiler-rt-01-sanitizer-nongnu.patch
>>
>>  Regards,
>>  Dmitry


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-02-14 15:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-13 13:34 shmctl not found when compiling compiler-rt Dmitry Golovin
2018-02-13 14:15 ` Szabolcs Nagy
2018-02-13 14:30   ` Matúš Olekšák
2018-02-13 14:33     ` Szabolcs Nagy
2018-02-13 14:33     ` Dmitry Golovin
2018-02-13 14:36       ` Matúš Olekšák
2018-02-13 14:51         ` Matúš Olekšák
2018-02-13 16:32   ` Julien Ramseier
2018-02-14 15:29   ` Dmitry Golovin

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).