/srv/irclogs.ubuntu.com/2024/06/29/#ubuntu-devel.txt

liushuyuahasenack: so there seems to be an issue with the unaligned memory access on arm devices when building gambas3. I found the workaround for this issue: make GCC generate full-length ARM code instead of Thumb/Thumb2 compressed code on armhf00:03
liushuyu... with: export DEB_CFLAGS_MAINT_APPEND = -marm and export DEB_CXXFLAGS_MAINT_APPEND = -marm00:03
ahasenackthat's way over my head00:03
ahasenackand which gcc? gcc-11, or without that change to d/rules, using the normal gcc?00:04
liushuyuahasenack: This works with any version of GCC00:04
liushuyuI think you want to use the default GCC (which is GCC 13)00:04
ahasenackI would prefer that, yes00:04
liushuyu... because poppler still needs a C++20 capable compiler00:05
ahasenackand does armel still need clang then? Or can it use the same trick?00:05
liushuyuahasenack: I am unsure what happened with armel, but I guess it can use the same trick, since Clang generates ARM-mode code by default on Ubuntu00:06
liushuyuThe full story is this: ARM devices (prior to aarch64), requires aligned memory access (usually needs to be aligned on the "word boundary", in armhf situation, one word = 32 bit). gambas3 has this bright idea where it reads the file using mmap() ...00:08
ahasenackbut that used to be a runtime error, no? misaligned memory access00:08
ahasenacksigbus iirc00:09
sarnoldsigbus, depending upon architecture00:09
ahasenackI haven't found the build error in the logs00:09
liushuyuahasenack: well, it actually happened during the build, but the make flags hid the errors00:09
sarnoldarm it was an implementation choice, some processors could cope, others couldn't, and some could only cope in 32bit or in 64bit mode, something like that ..00:09
liushuyugambas3 used a hack to remove the print out00:10
sarnoldin any event, any program doing unaligned access ought to be fixed00:10
sarnoldswitch pointer assignments to memcpy :(00:10
liushuyu... (cont'd) mmap basically tells the kernel to map the specified file description into memory and treat as a part of the memory space. However, gambas3 read the file by bytes (not by words), which generates an unaligned access00:11
liushuyu... (cont'd) unknown identifier issue was because their Makefile was so bad that did not handle the error correctly and let the build continue00:12
ahasenackcan we fix that instead? Do you know where it's happening? And how about changing the invocation commands to not hide the errors, and stop when they happen?00:12
liushuyusarnold: In aarch64, ARM provided a way to allow unaligned memory access, so this issue does not exist on arm6400:12
sarnoldliushuyu: I think our builders did sigbus on it though, heh00:13
liushuyu(see ARM reference manual ARM DDI 0487F.c ID072120 page E2-4044)00:14
liushuyuahasenack: It's kind of problematic to fix, due to how gambas3 handles file I/O (it expect the kernel to map the file into the memory, and all the downstream functions just operate on the pointer that points to the virtual address00:16
liushuyu(If you want to hear another horror story about a certain package, I do have another recent one, mentioned very briefly on my +1 report)00:18
ahasenacknot really, it's 21h20 here now :)00:19
sarnoldthat's firmly into weekend territory!00:19
ahasenackjust that 3.19.0-2ubuntu10 built on armhf before, perhaps with LocutusOfBorg's gcc-11 patch00:19
ahasenackhttps://launchpad.net/ubuntu/+source/gambas3/3.19.0-2ubuntu1000:19
ahasenackand, of course, previous poppler00:19
liushuyuahasenack: I know, it's code generation fengshui, where GCC so happens to not generate a certain instruction that requires hard memory alignment00:21
liushuyu... but newer GCC does generate this instruction (LDRD, Load Register Dual instruction) very often to optimize memory loads (since it can read 8 bytes at a time on a 32-bit system)00:22
=== stgraber is now known as Guest5653
=== stgraber is now known as Guest1191
=== Guest1191 is now known as stgraber
=== JanC is now known as Guest737
=== matttbe5 is now known as matttbe

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!