Better HN
topnewbestaskshowjobs
Log inSign up

MaskRay

257 karma · joined Mar 23, 2012 (14y ago) · 91 submissions

Submissions

comment 2y ago · link · parent

I almost use rr every day, along with a gdb frontend: cgdb.

rr record /tmp/Debug/bin/llvm-mc a.s && rr replay -d cgdb

I've have success story with some bugs only reproducible with LTO. Without rr it would be a significant challenge.

It would be nice if Linux kernel could be debugged with rr. Does anyone have success with kernel under rr+qemu ? :)

comment 2y ago · link · parent

tl;dr

- Mapping symbols describe data in code and instruction sets transition (e.g. A32<=>T32).

- Pending LLVM integrated assembler patch that will eliminate almost all mapping symbols without breaking disassemblers https://github.com/llvm/llvm-project/pull/99718

- RISC-V ISA extension `$x<ISA>` (unimplemented yet) would raise question where the relocatable files are more heterogeneous.

- Mach-O LC_DATA_IN_CODE describes ranges.

- Compressed .strtab and .symtab might be beneficial.

33.

Mapping Symbols: Rethinking for Efficiency(maskray.me ↗)

16 points · by MaskRay · 2y ago · 1 comment

34.

polyfill-glibc(github.com ↗)

1 points · by MaskRay · 2y ago · discuss

comment 2y ago · link · parent

Big thanks for the recent performance changes! The "many small inefficiencies" point resonates – it definitely shows how performance is hurt in many small areas.

(I aim to write blog posts every 2-3 weeks, but this latest one was postponed... I wrote this in relatively short time so that the gap would not be too long, and I really should take time to refine the post.)

comment 2y ago · link · parent

Thanks!

comment 2y ago · link · parent

https://mirrors.edge.kernel.org/pub/tools/llvm/ provides a PGO-optimized LLVM toolchain. It is likely much faster than Distro provided Clang.

You might also want to replace the malloc with mimalloc/snmalloc, which might yield ~10% performance boost.

comment 2y ago · link · parent

Thx. Fixed

39.

Integrated assembler improvements in LLVM 19(maskray.me ↗)

104 points · by MaskRay · 2y ago · 27 comments

comment 2y ago · link · parent

For people who prefer rebase and force push, https://getcord.github.io/spr/ is a great tool resembling Phabricator's `arc diff`.

https://github.com/orgs/community/discussions/3478 ("Improve workflow when force-pushing during code reviews") could use more support.

I've also got lots of complaints in this section when LLVM switched to GitHub PR: https://maskray.me/blog/2023-09-09-reflections-on-llvm-switc...

comment 2y ago · link · parent

https://www.sco.com/developers/gabi/latest/revision.html specifies

> Second draft published May 3, 1999. > ... > New dynamic section tags DT_RUNPATH and DT_FLAGS added. Dynamic section tag DT_RPATH moved to level 2.

In glibc, DT_RPATH and DT_RUNPATH have different semantics regarding precedence related to LD_LIBRARY_PATH. In FreeBSD rtld and musl, DT_RPATH and DT_RUNPATH are equivallent.

comment 2y ago · link · parent

Nice!

In llvm-project, obj2yaml pretty prints an object file in YAML and yaml2obj can convert the output back to an object file.

The test cases are a good way to explore the functionality: https://github.com/llvm/llvm-project/tree/main/llvm/test/too... https://github.com/llvm/llvm-project/tree/main/llvm/test/too...

comment 2y ago · link · parent

Linkers and Loaders

I have analyzed a few object file formats in another blog post https://maskray.me/blog/2024-01-14-exploring-object-file-for... (HN discussion: https://news.ycombinator.com/item?id=38998914)

ELF is technically not complicated and simpler than COFF and Mach-O.

comment 2y ago · link · parent

Yes! I immediately thought about APE when I read The 86open Project's FAQ. However, I feel that APE is less related to the blog post so decide not to add the link to the post.

comment 2y ago · link · parent

- 2003-2010 The SCO Group

- 2011- Xinous, but Xinous has stopped updating https://www.sco.com/developers/gabi/latest/contents.html . It seems that Xinous has moved on from System V based OpenServer/UnixWare. The newer OpenServer seems to be based on FreeBSD. They likely no longer care about the System V ABI.

Nowadays, people make proposals to the generic-abi Google Group. Essentially, a proposal is considered "standardized" if it receives approval from GNU, LLVM, and Ali Bahrami (Solaris representative).

Many GNU extensions are implemented by LLVM and adopted by BSD and newer ELF-based OSes. For extensions that are considered generic enough, it's recommended to propose them through the generic-abi Google Group. psABI documents generally prefer generic extensions over GNU or LLVM-specific ones.

comment 2y ago · link · parent

Decker builds on the legacy of HyperCard and MacPaint, and utilizes an interesting little language (https://beyondloom.com/decker/lil.html 2022 HN discussion: https://news.ycombinator.com/item?id=33393283)

47.

Another Year with Decker(beyondloom.com ↗)

1 points · by MaskRay · 2y ago · 1 comment

comment 2y ago · link · parent

I feel that The SCO Group's role in the evolution of the System V ABI seems to have been more of a curator/editor than an innovator, inheriting the System V ABI from previous entities. Given that the Tool Interface Standard (TIS) Committee has essentially released the ELF-related chapters into the public domain, and others have made changes, it's unclear what specific rights The SCO Group (and now Xinuos) could claim to reserve. (That said, their maintenance work needs to be remembered.)

comment 2y ago · link · parent

Thank you! This will be very useful. Yes, for C/C++ one needs:

* ISA manual * ELF (generic ABI, psABI (e.g. x86-64-psABI), OSABI) * DWARF * Floating-point * Language standards * Itanium C++ ABI

and probably a few other stuff.

> it seems like my failure to find the most up-to-date specification is simply because one doesn't exist.

While the up-to-date specification is unavailable, hopefully it is not too bad because all essential features have been completed as of 2001:)

RELR is a linker and loader feature, not on the compiler side. Compressed debug sections are a pretty natural extension.

comment 2y ago · link · parent

A few folks have asked me the generic ABI status (unmaintained?) and the availability of an up-to-date specification (no). I compiled “History” and “Evolution of the generic ABI” in the blog post.

I have two specific questions:

- Key features (symbol visibility, section groups, SHF_MERGE, etc) were all available as of April 2001. Where can we find the discussion mailing lists? Are they still available?

- How does the ABI end up being “All rights reserved” by SCO? Tool Interface Standard (TIS) Portable Formats Specification, version 1.2 effectively put the specification in the public domain.

51.

Evolution of the ELF object file format(maskray.me ↗)

148 points · by MaskRay · 2y ago · 51 comments

comment 2y ago · link · parent

Interesting. Traditionally, Clang's -O1 and higher optimizations have been considered less debuggable than GCC's.

Sony developers have proposed changes to improve the debugging experience and some work has been done, e.g. https://discourse.llvm.org/t/rfc-redefine-og-o1-and-add-a-ne...

* change representation to help make -g not change codegen : https://discourse.llvm.org/t/rfc-debuginfo-proposed-changes-...

comment 2y ago · link · parent

Thanks for mentioning nasm.

Both GNU assembler and LLVM integrate assembler parse and match instructions only once. hey then store an internal representation in memory and perform fixed-point iteration. The section/fragment representation gives a lot of flexibility.

In contrast, nasm parses and matches instructions multiple times depending on the optimization level. It also assigns addresses during parsing and uses an ad-hoc method for JMP/JCC instructions. The end conditions of the fixed-point iteration algorithm (global_offset_changed and stall_count) seem unconventional. -O0 does not "relax all" short jumps to near jumps.

comment 2y ago · link · parent

There is ongoing work to improve debuggability for optimized code. https://discourse.llvm.org/t/rfc-redefine-og-o1-and-add-a-ne...

``` Mode | Execution Time | Debuggability | Compile Time O0 | 1.0000 | 1.0000 | 1.0000 Og | 0.3439 | 0.5357 | 1.8630 O1 | 0.3082 | 0.4241 | 1.7880 O2g | 0.2823 | 0.4845 | 3.0420 O2 | 0.2514 | 0.3908 | 2.9380 ```

comment 2y ago · link · parent

Thanks for posting:)
1234