frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Ask HN: Help with doing statistics over machine code

2•phafu•1y ago
I'd like to do some statistics over the machine code gcc generates, such as a histogram of used instructions, average volatile/preserved registers usage of functions etc. For now just x86_64 SysV-ABI would be enough.

However I'm not aware of any pre-existing tool that lets me easily do this. The options I currently see are either make gcc output assembly and write a parser for the GNU Assembler format (possibly by reusing the asm-parser of the compiler-explorer project), or write a tool that reads (disassembles) object files directly using elfutils.

Any hints, prior work, further ideas, links to useful resources, or any other kind of help would be much appreciated.

Comments

baobun•1y ago
"Static analysis" should be a relevant search term. Assuming you don't need to tie the instructions back to C code then the "gcc" part seems circumstancial for implementation? I guess you might want to parse the ASM into an Abstract Syntax Tree (AST) represenation and work on that?

If you do want to tie it back to the source, this looks relevant: http://icps.u-strasbg.fr/~pop/gcc-ast.html

phafu•1y ago
For my purpose I don't need to get back to the original source, no.

The gcc part is only relevant with regards to what dialect of assembler I need to parse. If I go that route, I'd write a parser for the GNU assembler, and that would of course work with any code in that dialect, regardless from which compiler it came from (I haven't checked whether other compilers can produce GNU assembler though).

I made a tactile 3D map for my blind friend's birthday

https://www.reddit.com/r/BestofRedditorUpdates/comments/1vfwkrv/i_made_a_tactile_3d_map_for_my_bl...
1•georgecmu•29s ago•0 comments

Upper Mesopotamia

https://en.wikipedia.org/wiki/Upper_Mesopotamia
1•marysminefnuf•1m ago•0 comments

Gwern's Guardian Angels

https://twitter.com/bekhovsgun/status/2084863523692093669
2•reb•1m ago•0 comments

Saudi-led group completes $55B purchase of gaming giant EA

https://www.bbc.com/news/articles/cjejyl34345o
1•1659447091•1m ago•0 comments

Electricity Pricing in the Age of AI

https://power2026.ai/
1•mellosouls•4m ago•0 comments

First Builder Battle Starts Thurs

https://line4line.dev/
1•goldkey•13m ago•0 comments

Tell HN: Update to iOS 18.7.8" is updating users to iOS 26; Apple PSA

1•lynndotpy•14m ago•0 comments

Why Batteries Are Changing Faster Than the Industry Expected [video]

https://www.youtube.com/watch?v=pH-Tvba0o5E
1•thelastgallon•15m ago•0 comments

Zero-Mem: Zero-Token Memory Operations for LLM Agents

https://arxiv.org/abs/2607.29377
1•theanonymousone•16m ago•0 comments

Don't abandon Mozilla Firefox just yet (2017)

https://blog.jeaye.com/2017/12/16/firefox/
1•meysamazad•23m ago•1 comments

Thoughts on Learning Go

https://swlkr.com/posts/2022-07-23-thoughts-on-learning-go/
1•meysamazad•25m ago•0 comments

Fixing Braava M6 stuck wheels and grip issues

https://blog.thomasjungblut.com/random/fixing-braava-m6-wheel-mod/
1•meysamazad•26m ago•0 comments

The Optimal Choice of Hypothesis Is the Weakest, Not the Shortest

https://arxiv.org/abs/2301.12987
2•tosh•32m ago•0 comments

Show HN: Arabic–Hebrew artifact in GPT-5.4, 12,160 frozen trials

https://zenodo.org/records/21799525
2•rayanpal_•32m ago•0 comments

White House AI Guidelines Exempt U.S. Open Models from Government Review

https://www.wsj.com/tech/ai/white-houses-ai-guidelines-exempt-u-s-open-models-from-government-rev...
3•tosh•37m ago•0 comments

Message to Garcia

https://fee.org/articles/a-message-to-garcia/
1•0xWTF•37m ago•0 comments

What Most Developers Never See Inside Large Enterprises

https://www.youtube.com/watch?v=srtqr7VHvE4
1•pierres7•38m ago•1 comments

The Grid That Doubles the Strength of the Ground

https://practical.engineering/blog/2026/8/4/the-grid-that-doubles-the-strength-of-the-ground
1•michaefe•42m ago•0 comments

An SLM trained on $8 ESP32-S3

https://github.com/Carloscodix/qapla
1•pavelai•46m ago•1 comments

The Walls Are Closing in on Musk in Wisconsin Criminal Bribery Investigation

https://cmarmitage.substack.com/p/the-walls-are-closing-in-on-musk
3•JumpCrisscross•48m ago•0 comments

The Body Remembers but the Doctor Cannot- Experiments with AI in Personal Health

https://karankurani.com/writing/post/w_20260721140414_b0e102/the-body-remembers-but-the-doctor-ca...
1•BIackSwan•52m ago•0 comments

The Despair of the Professor in the Age of A.I

https://www.newyorker.com/news/fault-lines/the-despair-of-the-professor-in-the-age-of-ai
1•the-mitr•54m ago•0 comments

Airlines Don't Want You to Buy Their Cheapest Tickets

https://www.wsj.com/lifestyle/travel/airlines-really-dont-want-you-to-buy-their-cheapest-tickets-...
1•fortran77•1h ago•1 comments

Do You Think OpenAI Is Apple Circa the 1980s?

1•Taikhoom2010•1h ago•0 comments

I cracked 150 PRs a week [video]

https://www.youtube.com/watch?v=TK1OeQZswiQ
1•berenddeboer•1h ago•1 comments

Amtrak Bicycle Access

https://amtrak-bike-map.transittools.dev/
3•raybb•1h ago•0 comments

Tell HN: Wife used Chat GPT to set up her new biz domain, email, and website

2•jvanderbot•1h ago•1 comments

Wargamer's shed named UK Shed of the Year 2026

https://newatlas.com/tiny-houses/2026-shed-of-year-winner/
2•Gaishan•1h ago•0 comments

Neats and Scruffies

https://en.wikipedia.org/wiki/Neats_and_scruffies
2•Hooke•1h ago•0 comments

The auto industry is building for a past that's never coming back

https://www.wardsauto.com/news/the-auto-industry-is-building-for-a-past-thats-never-coming-back/8...
6•avonmach•1h ago•1 comments