ChanServ changed the topic of #zig to: zig programming language | | be excellent to each other | channel logs:
slugmatt_ has quit [Read error: Connection reset by peer]
dtz has quit [Remote host closed the connection]
dtz has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
slugmatt_ has joined #zig
<diltsman> Trying to add a compiler-rt function to Zig. I get this error: error: use of undeclared identifier '__aeabi_memcpy4'
<diltsman> I added the file name to ZIG_STD_FILES.
<diltsman> And I added the @export to compiler_rt.zig.
<andrewrk> can you show the file that you're getting the error in?
<diltsman> The error is on the @export line.
<diltsman> Seems like it can't find the file that I created.
<andrewrk> diltsman, "use of undeclared identifier" means that the identifier isn't found in the current scope
<andrewrk> e.g. it's not in the file that it's being referenced in
<andrewrk> if you're doing @export(__aeabi_memcpy4) then __aeabi_memcpy4 has to be in scope
<andrewrk> e.g. in vim put the cursor on __aeabi_memcpy4 and press `*` and it should find it declared
<diltsman> andrewrk: That means that I don't declare the @export in compiler_rt, right?
<diltsman> Do I just need to add the file name to the CMakeLists.txt file?
<andrewrk> diltsman, that's not correct. why not follow the example set by __aeabi_uidivmod?
<diltsman> andrewrk, __aeabi_uidivmod is in compiler_rt.zig along with the export. Should I just put all of the ARM function in that file? I was trying to follow the same directory layout that compiler-rt has.
<andrewrk> you can put it in another file if you want
<andrewrk> then you'll need the CMakeLists.txt change, and you have to @import the file
<diltsman> @import the file in compiler_rt.zig?
<diltsman> Nevermind, I see it.
<diltsman> Now that that is fixed...I have my aeabi_memcpy.zig file. When I build Zig it reformats the file and replaces all of the line endings with CRLF.
<andrewrk> when you say "it reformats the file", what software are you referring to?
<diltsman> I build the VS solution that CMake generated using "msbuild -p:Configuration=Release INSTALL.vcxproj"
<diltsman> During the build the file gets reformatted.
<andrewrk> are you sure it's not your text editor?
<andrewrk> I've never experienced that happening when using msbuild -p:Configuration=Release INSTALL.vcxproj
<andrewrk> maybe you are accidentally editing the installed copy rather than the source copy?
<diltsman> I'm using VS Code. I save the file, run the build, and then the file is reformatted in the editor.
<diltsman> Let me look at that.
<diltsman> You're right. I am looking at the installed copy.
<diltsman> So many things to trip you up. Finally hitting the compile error that I was expecting. Thanks!
<andrewrk> no problem. thanks for working on compiler_rt
<diltsman> At the very least I am going to get __aeabi_memcpy* and __aeabi_memset* done.
<diltsman> error: 'memcpy' is private
<diltsman> export fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, n: usize) ?[*]u8 {
<diltsman> Doesn't that mean that memcpy is public?
<andrewrk> export and pub are different concepts - you can add a `pub` to that
<diltsman> How do I have my function call the memcpy that is in builtin.zig?
<andrewrk> diltsman, @memcpy
<diltsman> Ah.
<daurnimator> andrewrk: so how does that end up working? I recall that llvm can sometimes end up optimizing the implementation in there to a call to __aeabi_memcpy
<andrewrk> daurnimator, yeah if it's the body of __aeabi_memcpy then it can't do that. it should probably just be 1 line of inline assembly that jumps to memcpy
<andrewrk> I haven't looked at llvm's implementation yet
<daurnimator> andrewrk: but memcpy ends up being a jump to __aeabi_memcpy...
<daurnimator> there has to be some sort of annotation to tell llvm "this *is* the memcpy implementation; don't optimise me into a memcpy call"
<andrewrk> if you name the function `memcpy` then it knows that
<andrewrk> and export it
<daurnimator> okay. I thought we might have been relying on e.g. `asm volatile` to avoid such things.
WilhelmVonWeiner has quit [Ping timeout: 246 seconds]
bheads has quit [Ping timeout: 246 seconds]
<andrewrk> new documentation section:
<daurnimator> andrewrk: thanks :)
knebulae has quit [Ping timeout: 250 seconds]
jjido has joined #zig
dewf has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mikdusan> heh so now an older Xcode version 8.2.1: `clang —version` yields “Apple LLVM version 8.0.0 (clang-800.0.42.1)”
<mikdusan> and a fresh build of llvm8, `/opt/clang-8.0.0/bin/clang —version` yields “clang version 8.0.0”
<mikdusan> we have sync! bad sync. but sync nonetheless
bheads has joined #zig
knebulae has joined #zig
darithorn has joined #zig
MajorLag has joined #zig
tgschultz has quit [Ping timeout: 268 seconds]
MajorLag is now known as tgschultz
<mikdusan> is there any way to short-circuit and jump straight into an alternate switch case? here’s a code reduction of what i’m currently going with.
dewf has quit [Quit: Leaving]
return0e_ has quit [Remote host closed the connection]
return0e has joined #zig
return0e has quit [Remote host closed the connection]
Akuli has joined #zig
<andrewrk> mikdusan, see the note about "computed goto"
<andrewrk> mikdusan, if you can show that the optimized code in release fast mode would benefit further from computed goto, I'll open an issue to add a feature to zig detecting this pattern and ensuring the optimization occurs
Zaab1t has joined #zig
Zaab1t has quit [Quit: bye bye friends]
Ichorio has joined #zig
jjido has joined #zig
return0e has joined #zig
Akuli has quit [Quit: Leaving]
adam12 has joined #zig
Sahnvour has joined #zig
<Sahnvour> hi
<Sahnvour> andrewrk: I skimmed through the system V doc at, and noticed that the quotes in zig's source seem outdated, fwiw
<andrewrk> hi Sahnvour, just read your patch. looks great
<Sahnvour> I shamelessly did not spend much time on this, so maybe that makes no difference for zig, just wanted to let you know
<andrewrk> that's interesting, I wouldn't have expected the system v ABI to change so rapidly
<andrewrk> thanks for letting me know
<andrewrk> I'm about to give a 10 min talk on zig, should be fun. not sure if it's going to be recorded or not, but I'll turn the content into a blog post regardless
<Sahnvour> yay for blog posts
Ichorio has quit [Ping timeout: 268 seconds]
Sahnvour has quit [Read error: Connection reset by peer]
fsateler has joined #zig
fsateler_ has quit [Ping timeout: 255 seconds]
fsateler has quit [Read error: Connection reset by peer]
fsateler has joined #zig