ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
quc has quit [Read error: Connection reset by peer]
<andrewrk> t5c, I did some research. I know how to implement __guard_local
<andrewrk> it's actually an extern variable that needs to be in the ".openbsd.randomdata" section
<andrewrk> and that's it
<andrewrk> extern var __guard_local: c_long section(".openbsd.randomdata");
<andrewrk> comptime { if (builtin.os == builtin.Os.openbsd) @export("__guard_local", __guard_local, builtin.GlobalLinkage.Strong);
<andrewrk> put that in std/special/builtin.zig and do a build-exe. this will generate foo.o builtin.o compiler_rt.o
<andrewrk> link those together and you should have no missing symbols
quc has joined #zig
<GitHub14> [zig] andrewrk pushed 3 new commits to master: https://git.io/vhLGN
<GitHub14> zig/master af7073b Andrew Kelley: Merge branch 'BraedonWooding-patch-3'
<GitHub14> zig/master fa5b0ef Andrew Kelley: doc fixups
<GitHub14> zig/master 938d791 braedonww@gmail.com: Added argtype and error inferring info
<GitHub109> [zig] andrewrk closed pull request #1014: [Documentation] Add Error Union Documentation and ArgType (master...patch-3) https://git.io/vhLGj
quc has quit [Ping timeout: 240 seconds]
JinShil has joined #zig
<GitHub183> [zig] andrewrk pushed 1 new commit to master: https://git.io/vhLn8
<GitHub183> zig/master 4308541 Andrew Kelley: update github.com/zig-lang to github.com/ziglang
<GitHub162> [zig] andrewrk pushed 1 new commit to master: https://git.io/vhLcl
<GitHub162> zig/master b74dda3 Andrew Kelley: std.zig.tokenizer: support hex escape in char literals
darithorn has quit [Quit: Leaving]
dgfx has joined #zig
dgfx has quit [Client Quit]
<GitHub105> [zig] andrewrk pushed 1 new commit to master: https://git.io/vhLBj
<GitHub105> zig/master e6afea9 Andrew Kelley: zig fmt: support aligned ptr with bit fields
<GitHub177> [zig] andrewrk pushed 1 new commit to master: https://git.io/vhLRv
<GitHub177> zig/master ca49b6f Andrew Kelley: struct fields with no explicit type are not supported...
<GitHub85> [zig] andrewrk pushed 1 new commit to master: https://git.io/vhLR7
<GitHub85> zig/master dfc3e11 Andrew Kelley: zig fmt: fix handling of comments at top of file
davr0s has joined #zig
Hejsil has joined #zig
<GitHub130> [zig] andrewrk pushed 3 new commits to master: https://git.io/vhLEV
<GitHub130> zig/master 000c01a Andrew Kelley: zig fmt: handle missing trailing comma in array literals
<GitHub130> zig/master 3f302f8 Andrew Kelley: handle more cases of inserting trailing commas
<GitHub130> zig/master 08f95d0 Andrew Kelley: enum fields with a type are not supported...
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<GitHub161> [zig] andrewrk pushed 1 new commit to master: https://git.io/vhLu3
<GitHub161> zig/master 56cb7f1 Andrew Kelley: update json_test to be compliant with zig source encoding...
<GitHub53> [zig] andrewrk pushed 1 new commit to master: https://git.io/vhLuX
<GitHub53> zig/master a630d3e Andrew Kelley: zig fmt: fix rendering of align keyword of slice type
davr0s has joined #zig
<Hejsil> andrewrk, we probably want a lot of these parser fixes on the zig-fmt-pointer-reform branch too :)
<Hejsil> Because that branch cant parse the randomizer
<andrewrk> Hejsil, good point. the actual commit that changes prefix -> postfix is small, I might just branch off master and make that commit against it
<Hejsil> Seeing my git diff explode is horrifying
<Hejsil> Though most format changes do look alot better than my original format
<andrewrk> I'm going to bed. Talk to you later
<donpdonp> c.pthread_create(&thread, null, net_go => error: expected type '?extern fn(?&c_void) ?&c_void', found 'fn(?&c_void) ?&c_void'
<donpdonp> so I want to define net_go myself in the zig code. how do I satisfy the pthread_create param?
<donpdonp> (the only diff in the signatures is extern)
<donpdonp> extern fn net_go(url_cstr: ?&c_void) ?&c_void does work, but im not really sure if thats correct to do.
<donpdonp> in other news, how do I get that c_void ptr back into a string?
<donpdonp> var url = @ptrCast(&[]const u8, url_cstr); => error: cast increases pointer alignment / '?&c_void' has alignment 1 / '&[]const u8' has alignment 8
<donpdonp> which is some nice error detail but i never had to think about c string alignment before.
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<donpdonp> apparently i was trying too hard. var url = @ptrCast(&u8, url_cstr); works.
<donpdonp> its a point to a single u8, but hey go head and read any number of u8's after that one :)
davr0s has joined #zig
<Hejsil> I think defining net_go as extern is correct
<Hejsil> That ensures C calling convention, which is what pthread probably wants :)
<donpdonp> Hejsil: nod. thx.
Hejsil has quit [Quit: Page closed]
Hejsil has joined #zig
asdfghibklo has joined #zig
asdfghibklo has quit [Client Quit]
cmc has joined #zig
<donpdonp> deps/SoftFloat-3e/source/8086/s_commonNaNToF128M.c.o
<donpdonp> saw that .o fly by during make. 8086 float emulation or some such? zounds.
<t5c> andrewrk: compiling the echo world example works. running it give a segfault. I did horrible things to link.cpp but it does compile now...
<t5c> can't really debug the binary because OpenBSDs gdb is too old it seems
<t5c> *sigh* why is it never easy with this OS.
<t5c> ok, debugging works. segfaulting at _thread_finalize();
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
JinShil has quit [Quit: Leaving]
quc has joined #zig
<t5c> andrewrk: https://pastebin.com/2Sbru00u that is the WIP right now. I commented everything out in analyze.cpp just to get it linking. it now produces binaries that segfault on every libc call
<t5c> analyze.cpp and link.cpp
cmc has quit [Ping timeout: 260 seconds]
davr0s has joined #zig
bheads has quit [Quit: Konversation terminated!]
bheads has joined #zig
bheads has quit [Quit: Konversation terminated!]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
return0e has quit [Remote host closed the connection]
davr0s has joined #zig
Hejsil has quit [Quit: Page closed]
return0e has joined #zig
return0e has quit [Read error: No route to host]
Hejsil has joined #zig
return0e has joined #zig
<andrewrk> t5c, can I see your output for --verbose-link ?
darithorn has joined #zig
<andrewrk> t5c, looks like you commented out some of the libc start objects. that's probably the cause of the segfault
<andrewrk> libc depends on a bunch of .o files
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Hejsil has quit [Quit: Page closed]
davr0s has joined #zig
Hejsil has joined #zig
<Hejsil> Now that we have @typeInfo, I would assume that a lot of builtins goes away, correct?
<t5c> andrewrk: lld --gc-sections -m elf_x86_64 -o foo /usr/bin/../lib/crtbegin.o -L /usr/bin/../lib -L /usr/bin/../lib -dynamic-linker /lib64/ld-linux-x86-64.so.2 ./zig-cache/foo.o -L /usr/local/lib --as-needed --no-as-needed -lc -lm --as-needed --no-as-needed /usr/bin/../lib/crtend.o
cmc has joined #zig
<andrewrk> Hejsil, correct
<Hejsil> Right, I already started the effort on the std-meta branch
<Hejsil> The real question is, if we even want a ArgType fn in there
<andrewrk> why's that?
<Hejsil> Idk
<Hejsil> We could write a lot of convenience functions like that then
<Hejsil> And ArgType is just @typeInfo(T).Fn.args[0].type
<Hejsil> Actually, the real question is
<Hejsil> Do we want things like FieldType, fieldName, ArgType
<Hejsil> All those pretty trivial function
<andrewrk> in std.meta? or as builtins?
<Hejsil> std.meta
<Hejsil> I assume @ArgType goes away
<andrewrk> I see, idea being that they don't really save that much typing
<Hejsil> True
<Hejsil> tagName, maxValue, minValue do save some lines
<andrewrk> I don't have a strong opinion on this
<Hejsil> Hmm. Well, it's not a high priority anyways. And my tagName impl only works well when we have "pass structs by value"
<andrewrk> that issue is next in line after pointer reform
<Hejsil> Hurray!
<andrewrk> also I have a surprise announcement to make later today
<Hejsil> Surprise?
<Hejsil> Hmmm
<Hejsil> Looking forward to it. I can't quite imagine what it might be. I guess it truly is a surprise
<andrewrk> :)
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ichorio has joined #zig
Hejsil has quit [Ping timeout: 260 seconds]
davr0s has joined #zig
cmc has quit [Ping timeout: 260 seconds]
<andrewrk> t5c, do you have an openbsd box you would be willing to add to a buildbot cluster for CI testing?
cenomla has joined #zig
<darithorn> are there any plans on supporting recursive structs from C?
cenomla has quit [Quit: cenomla]
bheads has joined #zig
<t5c> andrewrk: I could set one up and give you full access. Small VPS should be enough I think?
<andrewrk> t5c, that would be lovely
<andrewrk> darithorn, a struct that has a pointer to itself? does that not already work?
<t5c> andrewrk: canada or france prefered?
<t5c> dunno where you are located
<darithorn> apparently not because it says @cImport generated invalid zig code and then it has a note 'foo_struct' depends on itself
<andrewrk> t5c, canada
<andrewrk> darithorn, that's a bug. something went wrong
<darithorn> yeah i'm trying to see if i can narrow it down
steveno_ has joined #zig
<t5c> andrewrk: dunno, I like the Go approach to static binaries. but since openbsd stay stable for at least one release it should be fine
<darithorn> andrewrk: it's happens when they forward declare the struct using a typedef https://clbin.com/41zFI
steveno_ has quit [Ping timeout: 265 seconds]
steveno_ has joined #zig
<andrewrk> t5c, that's an option
<andrewrk> darithorn, that looks correct
<andrewrk> I fixed a bug like this recently. are you using a master branch build?
commander has quit [Remote host closed the connection]
<darithorn> hm, it's been a few days since i've updated, let me pull and rebuild and see if that fixes it
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<andrewrk> t5c, to be clear I prefer fully static builds as well. I just want to respect the official ABI as specified by the operating system
<t5c> yeah no worries ;)
<t5c> btw. to clarify the openbsd thing: openbsd-6.3 stays stable (API and ABI), openbsd-current does not.
cenomla has joined #zig
<darithorn> andrewrk it doesn't fix it. it fails with the same error saying "`foo` depends on itself", which is defined as "const foo = struct_foo;"
<darithorn> it passes the translate_c test but if you try to compile the code that it generates it fails
commander has joined #zig
<andrewrk> darithorn, oh, interesting. Alright I'll take a look
cenomla has quit [Quit: cenomla]
Ichorio has quit [Ping timeout: 252 seconds]
<darithorn> is there a way to turn a const fn pointer to a non-const fn pointer?
<darithorn> i need to give a C struct a function pointer but the type of &myFunc is &const extern fn(...)