Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8854447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:52:57+00:00 2026-06-14T13:52:57+00:00

My c/obj-c code (an iOS app built with clang) has some functions excluded by

  • 0

My c/obj-c code (an iOS app built with clang) has some functions excluded by #ifdefs. I want to make sure that code that gets called from those functions, but not from others (dead code) gets stripped out (eliminated) at link time.
I tried:

  1. Adding a local literal char[] in a function that should be eliminated; the string is still visible when running strings on the executable.
  2. Adding a function that should be eliminated; the function name is still visible when running strings.

Before you ask, I’m building for release, and all strip settings (including dead-code stripping, obviously) are enabled.

The question is not really xcode/apple/iOS specific; I assume the answer should be pretty much the same on any POSIX development platform.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:52:59+00:00Added an answer on June 14, 2026 at 1:52 pm

    (EDIT)

    In binutils, ld has the --gc-sections option which does what you want for sections on object level. You have several options:

    • use gcc‘s flags -ffunction-sections and -fdata-sections to isolate each symbol into its own section, then use --gc-sections;

    • put all candidates for removal into a separate file and the linker will be able to strip the whole section;

    • disassemble the resulting binary, remove dead code, assemble again;

    • use strip with appropriate -N options to discard the offending symbols from the
      symbol table – this will leave the code and data there, but it won’t show up in the symbol table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just getting started with Obj-C and iOS programming. I have some code that loads
Here's some example code: class Obj attr :c, true def == that p '=='
I have some code that looks like this: foreach(var obj in collection) { try
I have some code in an app that creates a CoreData managed object. In
I have code that looks like this: obj.foo(); // obj might, or might not
I'm looking to create a iOS app utilizing SIP functionality for various functions. I've
I have an iOS app working and am trying to clean up some of
I am currently designing an iOS 5 iPhone app that will use a .NET
I've been tasked with adding some c++ code into an iOS project. The c++
I would like to make a set of help pages for an iOS app,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.