On Mon, Mar 4, 2024 at 9:55 AM Evgeny Chormonov <en.chormo...@gmail.com> wrote:
>
> I'm using Linux as my platform, but I'm curious why this solution is 
> restricted to Linux systems only?
> https://github.com/golang/go/blob/master/src/runtime/asan/asan.go#L5

That's just the list of systems for which we support asan.  Offhand I
don't know what other systems the asan library supports.  I don't
think there is any obstacle to porting Go's asan support to other
systems that the asan library supports, though of course some such
ports would require new Go assembly code.

Ian


> понедельник, 4 марта 2024 г. в 00:43:09 UTC+3, Ian Lance Taylor:
>>
>> On Sun, Mar 3, 2024 at 1:25 PM Evgeny Chormonov <en.cho...@gmail.com> wrote:
>> >
>> > I noticed that ASAN checker in the Go source code is defined using CGO 
>> > https://github.com/golang/go/blob/master/src/runtime/asan/asan.go
>> > But the C ASAN functions are called from the Go runtime using assembly 
>> > code instead of a common CGO call. 
>> > https://github.com/golang/go/blob/master/src/runtime/asan_amd64.s#L36
>> >
>> > This discovery has sparked my interest, and I am curious to know if I can 
>> > employ a similar method to execute my own C functions from my Go code. 
>> > Could you clarify if this is a viable option?
>>
>> Viable is in the eyes of the beholder. You can use a similar method.
>> But you have to hand-write the assembler code for each C function you
>> want to call. And if the C function ever blocks on, say, network I/O,
>> your entire Go program can hang unexpectedly. We only use this
>> technique for ASAN because we have a very limited number of functions
>> to call, and we know for sure that those functions can never block.
>>
>> Ian
>
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/e5dd08b6-2e05-4bf2-9f51-89d2cb55622fn%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVEbVvz%2BTJYGtKbZe-3gETWWwC%2Bs1%3Dygahv9czC6xt_ug%40mail.gmail.com.

Reply via email to