https://github.com/dacap/bigdep-test
A test to try to fix one linking issue, but it doesn't (it looks like my case is more complex, see website link)
https://github.com/dacap/bigdep-test
Last synced: 8 months ago
JSON representation
A test to try to fix one linking issue, but it doesn't (it looks like my case is more complex, see website link)
- Host: GitHub
- URL: https://github.com/dacap/bigdep-test
- Owner: dacap
- Created: 2019-07-25T16:59:28.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-25T16:59:54.000Z (almost 7 years ago)
- Last Synced: 2025-07-14T20:50:15.093Z (11 months ago)
- Language: C++
- Homepage: https://twitter.com/davidcapello/status/1154208100720762881
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
*Note: This was tested on macOS with clang*
Example to show the difference of the binary size depending on compiler flags.
There are three libraries:
* `big`: has a `big()` function, requires `14k`
* `small`: has a `small()` function, requires `816 bytes`
* `bigsmall`: has both functions in the same compilation unit (in the
same `.cpp` file), requires `14k`, but *depending on which function
you use*, you should avoid the `big()` cost
There are three executables:
* `usebig`: uses `big()` from `big` library, it should be always a big executable, e.g. `16k`
* `usesmall`: uses `small()` from `small` library, it should be always
a small executable, e.g. `4.2k`
* `usesmall_with_bigsmall`: uses `small()` from `bigsmall` library, it
should be a small executable (like `usesmall`, `4.2k`), but
depending on the compiler options, you will get the cost of `big()`
function (like `usebig`, `16k`)
With `CMAKE_CXX_FLAGS=""` and `CMAKE_EXE_LINKER_FLAGS=""` we get:
```
usebig 16K
usesmall 4.2K
usesmall_with_bigsmall 16K
```
With `CMAKE_EXE_LINKER_FLAGS="-dead_strip"` we get:
```
usebig 16K
usesmall 4.2K
usesmall_with_bigsmall 4.2K
```