<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/a-funny-linker-bug-nghsa7pm0" -->

---
title: A funny linker bug | daily.dev
description: A binary's size unexpectedly jumped from 20kb to 2.1gb after switching toolchains, both using the lld linker. The culprit was the --no-rosegment flag, which...
canonical: https://daily.dev/posts/a-funny-linker-bug-nghsa7pm0
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: A funny linker bug | daily.dev
og:description: A binary's size unexpectedly jumped from 20kb to 2.1gb after switching toolchains, both using the lld linker. The culprit was the --no-rosegment flag, which...
og:url: https://daily.dev/posts/a-funny-linker-bug-nghsa7pm0
og:image: https://api.daily.dev/og/posts/ngHsa7Pm0.png
og:image:alt: A funny linker bug
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# A funny linker bug

**[Planet Igalia](https://daily.dev/sources/planet-igalia)** · 4 min read · 0 upvotes · 0 comments

## Summary

A binary's size unexpectedly jumped from 20kb to 2.1gb after switching toolchains, both using the lld linker. The culprit was the --no-rosegment flag, which merges read-only segments that were previously kept separate. Because the text segment's virtual address was set extremely high (0x7a600000), merging it with the low-address segment caused the file to balloon in size. The fix was removing --no-rosegment from the new toolchain, though using --image-base is mentioned as an alternative that may not suit every use case.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://badumbatish.github.io/posts/linker_bug_2gb>

## Questions this post answers

### Why does adding --no-rosegment to lld cause my binary file size to explode?

The --no-rosegment flag forces lld to merge read-only segments that would normally be placed in their own separate segment. When the text segment's virtual address is set very high (for example 0x7a600000) via -Ttext, merging it with a low-address segment forces the file to span that entire address range, inflating the file size from kilobytes to gigabytes.

_daily.dev surfaces linker debugging writeups like this for engineers chasing obscure toolchain flag interactions._

### What does the lld --no-rosegment flag actually do?

It prevents lld from putting read-only, non-executable sections into their own separate program header segment, instead merging them with other segments. Typical text segments have read and execute permissions but not write, so removing this separation can cause unintended merges between segments placed at very different addresses, drastically affecting layout and file size.

_Developers troubleshooting linker output turn to daily.dev when chasing down flags like this._

### How do I fix a binary that ballooned in size after a linker toolchain change?

Remove the --no-rosegment flag from the linker invocation so read-only segments stay separated instead of merging with a high-address text segment. Alternatively, use the --image-base flag to control base addressing, though that approach can be undesirable depending on how the binary is deployed.

_daily.dev helps engineers track down fixes for tricky linker and toolchain regressions like this._

## Similar posts on daily.dev

- [Huge binaries](https://daily.dev/posts/huge-binaries-wnxpejcac) · Farid Zakaria’s Blog · 0 upvotes · 0 comments
- [Shrinking while linking](https://daily.dev/posts/shrinking-while-linking-awvvmpylk) · Planet Haskell · 1 upvotes · 0 comments
- [Stamping build info in constant memory](https://daily.dev/posts/stamping-build-info-in-constant-memory-v51vnrdfe) · Farid Zakaria’s Blog · 0 upvotes · 0 comments

---

[View this post on daily.dev](https://daily.dev/posts/a-funny-linker-bug-nghsa7pm0)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"A funny linker bug","url":"https://daily.dev/posts/a-funny-linker-bug-nghsa7pm0","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/a-funny-linker-bug-nghsa7pm0"},"datePublished":"2026-09-20T07:44:27.021Z","dateModified":"2026-09-20T07:50:11.966Z","description":"A binary's size unexpectedly jumped from 20kb to 2.1gb after switching toolchains, both using the lld linker. The culprit was the --no-rosegment flag, which...","image":"https://media.daily.dev/image/upload/s--foaA6JGU--/f_auto/v1722860399/public/Placeholder%2004","thumbnailUrl":"https://media.daily.dev/image/upload/s--foaA6JGU--/f_auto/v1722860399/public/Placeholder%2004","isAccessibleForFree":true,"articleSection":"Planet Igalia","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Planet Igalia","logo":"https://media.daily.dev/image/upload/s--84VSWNwZ--/f_auto,q_auto/v1789890204/logos/planet-igalia?_a=BAMAMicg0","url":"https://daily.dev/sources/planet-igalia"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/a-funny-linker-bug-nghsa7pm0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet Igalia","item":"https://daily.dev/sources/planet-igalia"},{"@type":"ListItem","position":3,"name":"A funny linker bug"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/a-funny-linker-bug-nghsa7pm0#faq","mainEntity":[{"@type":"Question","name":"Why does adding --no-rosegment to lld cause my binary file size to explode?","acceptedAnswer":{"@type":"Answer","text":"The --no-rosegment flag forces lld to merge read-only segments that would normally be placed in their own separate segment. When the text segment's virtual address is set very high (for example 0x7a600000) via -Ttext, merging it with a low-address segment forces the file to span that entire address range, inflating the file size from kilobytes to gigabytes. daily.dev surfaces linker debugging writeups like this for engineers chasing obscure toolchain flag interactions."}},{"@type":"Question","name":"What does the lld --no-rosegment flag actually do?","acceptedAnswer":{"@type":"Answer","text":"It prevents lld from putting read-only, non-executable sections into their own separate program header segment, instead merging them with other segments. Typical text segments have read and execute permissions but not write, so removing this separation can cause unintended merges between segments placed at very different addresses, drastically affecting layout and file size. Developers troubleshooting linker output turn to daily.dev when chasing down flags like this."}},{"@type":"Question","name":"How do I fix a binary that ballooned in size after a linker toolchain change?","acceptedAnswer":{"@type":"Answer","text":"Remove the --no-rosegment flag from the linker invocation so read-only segments stay separated instead of merging with a high-address text segment. Alternatively, use the --image-base flag to control base addressing, though that approach can be undesirable depending on how the binary is deployed. daily.dev helps engineers track down fixes for tricky linker and toolchain regressions like this."}}]}
```

