Post ArqlktqVYcFGJs0oe8 by koakuma@uwu.social
(DIR) More posts by koakuma@uwu.social
(DIR) Post #ArqlktqVYcFGJs0oe8 by koakuma@uwu.social
2025-03-06T16:18:28Z
1 likes, 0 repeats
Anyone here familiar with SPARC binutils internals? I'm having a rather odd case where the same instruction (and same binary sequence) gets interpreted differently depending on who compiles it :cirnothinking: Say, I have this `decode.s` file containing the following line:decode: addxccc %g0, %g0, %g0One VIS3 instruction, very simple. Then assemble it with both gcc and clang:gcc -mcpu=niagara4 -c decode.s -o decode-gcc.oclang -mcpu=niagara4 -c decode.s -o decode-clang.oAnd now, if I run objdump on the files, the results are different:decode-clang.o: file format elf64-sparcDisassembly of section .text:0000000000000000 <decode>: 0:81 b0 02 60 unknownCompare with GCC's:decode-gcc.o: file format elf64-sparcDisassembly of section .text:0000000000000000 <decode>: 0:81 b0 02 60 addxccc %g0, %g0, %g0In both cases the binary stream is the same, but why does objdump decodes it as "unknown" with the clang-built file?#AskFedi #Binutils #GCC #SPARC
(DIR) Post #ArsDbMYyvLRSMb1040 by jeffpc@mastodon.radio
2025-03-08T21:31:19Z
0 likes, 0 repeats
@koakuma I’m going based on fuzzy memory of other architectures here. Some architectures include various flavor flags elsewhere in the ELF (maybe in notes?). This flavor is used by some ABIs for “this binary uses foo-type instructions” that the linker-loader can use. IIRC objdump can use those as well to tweak disassembly output. It’s been about 9 years since I thought about this, so I may be wrong.I’d compare *all* of the ELF contents.
(DIR) Post #ArsDbNMxvVQMrcOuyO by koakuma@uwu.social
2025-03-09T08:59:21Z
1 likes, 0 repeats
@jeffpc Yeah, it seems like GNU tools adds and reads the `gnu` attribute sections in the binaryThough weird objdump results aside, the lack of it doesn't seem to affect anything else :cirnothinking:
(DIR) Post #As2bIOhx4C1tzfIdJg by Suiseiseki@freesoftwareextremist.com
2025-03-14T09:23:31.774480Z
0 likes, 0 repeats
@koakuma Seems like clang doesn't construct the file properly.But why would you even use clang instead of the best compiler?