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).

The night 142 of my servers went up in the clouds Physically

https://exquisite.tube/w/nQbc54t4G7YGaqiryZ7mg1
1•jaypatelani•1m ago•0 comments

Sony's First Computer – The SMC-70 from 1982 [video]

https://www.youtube.com/watch?v=cT2-7KkPkBc
1•ksymph•2m ago•0 comments

Why Egyptian farmers are growing crops under solar panels

https://grist.org/energy/why-egyptian-farmers-are-growing-crops-under-solar-panels/
1•thunderbong•2m ago•0 comments

Influential people don't network, they build social capital

https://www.thecaringtechie.com/p/influential-people-build-social-capital
1•AntonZ234•8m ago•0 comments

V and P Industry contract manufacturing

https://vnpindustry.com/
2•vrathee•11m ago•0 comments

David Sacks to AI Labs: "Stop pretending you need anyone else's permission"

https://xcancel.com/DavidSacks/status/2098973625252708460#m
3•ozozozd•12m ago•0 comments

Show HN: SubSweep – find recurring charges in an Australian bank statement CSV

https://www.subsweep.com.au
1•jqadan•12m ago•0 comments

Ask HN: C or C++?

1•skwasimin•15m ago•0 comments

Show HN: Hindsight – Explore how YouTube channels discuss issues over time

https://github.com/brishtiteveja/hindsight
1•andy0595•22m ago•0 comments

Zig Guide Live: Every Snippet Verified Against Master

https://www.ziglang.in/
2•rguiscard•27m ago•1 comments

Ask HN: What Makes a CTO?

https://heltes.com/mapapp/what_makes_a_cto/
1•heltale•28m ago•0 comments

Neural Turing Machines (2014)

https://arxiv.org/abs/1410.5401
3•peter_d_sherman•35m ago•0 comments

Schott Glass, Russian Lenses, and a Jupiter 5 Do Over

https://www.leicalensesfornormalpeople.com/2022/01/18/schott-glass-russian-lenses-and-a-jupiter-5...
1•andsoitis•35m ago•0 comments

The Great Google Scam: The "Delete" Button That Deletes Nothing

https://medium.com/@istokovicsgyorgy79/the-great-google-scam-the-delete-button-that-actually-dele...
1•Bitu79•35m ago•0 comments

Too much light at night changes the shape and working of the heart

https://www.escardio.org/news/press/press-releases/too-much-light-at-night-changes-the-shape-and-...
2•Markoff•39m ago•0 comments

Unsafe at Any Speed

https://en.wikipedia.org/wiki/Unsafe_at_Any_Speed
1•js2•49m ago•0 comments

Claude AIs tricked into unescapable conversation [beginning: Ctrl^F to "AI 1"]

https://www.thisamericanlife.org/896/transcript
2•alister•56m ago•0 comments

Show HN: The hacker who took 3,998 BTC is texting Blockstream on-chain, live

https://liquidsaga.miguelmedeiros.dev
1•miguelmedeiros•1h ago•0 comments

AI is breaking our proxies for expertise

https://www.seangoedecke.com/ai-is-breaking-our-proxies-for-expertise/
3•daniel-sc•1h ago•1 comments

Show HN: Words of Hanoi

https://crux.quest/hanoi
1•saretup•1h ago•0 comments

Terrence Tao: AI Is Teaching Us Something Uncomfortable About Our Own Minds [video]

https://www.youtube.com/watch?v=DRDoABHToEo
4•thelastgallon•1h ago•0 comments

Anthropic CEO says AI industry needs to give safety measures time to catch up

https://apnews.com/article/anthropic-ai-dario-amodei-d59552edcb27892d8ee4d98a48397706
1•xiaoyu2006•1h ago•0 comments

BioCompute is chasing a world where a dollar can buy you a million TB of storage

2•darius88•1h ago•2 comments

WordPress object cache backed by shared memory, ~19% faster than Memcached

https://wordpress.org/plugins/yac-object-cache/
2•laruence•1h ago•0 comments

Show HN: AI Rendering in Realtime at 3dbae

https://www.youtube.com/watch?v=Q9EZkVx-pws
1•Shraddha__Singh•1h ago•0 comments

Show HN: SF Title Alert

https://sftitlealert.com/
1•arkadiyt•1h ago•0 comments

Apple launches a new way to prove a photo was shot with an iPhone (not AI)

https://www.niemanlab.org/2026/09/apple-launches-a-new-way-to-prove-a-photo-was-shot-with-an-ipho...
2•ilamont•1h ago•2 comments

Show HN: The iPhone Duo fold effect on any Windows laptop

https://winduo.baselashraf.com/
1•BaselAshraf81•1h ago•1 comments

JPMorgan cut off Situational Awareness lending after AI losses

https://www.ft.com/content/916eea1b-d483-49e1-9a70-53b4df8f9870
5•1vuio0pswjnm7•1h ago•0 comments

Lizard Evolution in Real Time: Field Experiments on Evolutionary Process [video]

https://www.youtube.com/watch?v=MslG1nh7JdI
1•thunderbong•1h ago•0 comments