• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: dead stripping not working in intel build? & Re: dead-code stripping, pass two...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dead stripping not working in intel build? & Re: dead-code stripping, pass two...


  • Subject: Re: dead stripping not working in intel build? & Re: dead-code stripping, pass two...
  • From: Rua Haszard Morris <email@hidden>
  • Date: Thu, 18 May 2006 10:54:43 +1200

I found a solution to my problem: turning on "Symbols hidden by default" (aka [GCC_SYMBOLS_PRIVATE_EXTERN, -fvisibility=hidden]) allowed the unused code to be dead stripped successfully, and the i386 build now links just as well as the ppc.

I am curious as to whether specifying an export file should implicitly turn on -fvisibility=hidden; I had assumed this was the way it worked, it's what you expect when specifying an exported symbols file, and it seems to work this way in ppc.

Possibly this might alleviate some of the problems people are having with executables being orders of magnitude larger than when built by CodeWarrior ("that is a _phat_ binary, man").

Thanks,
Rua HM.

On 17/05/2006, at 2:26 PM, Rua Haszard Morris wrote:

I am having trouble linking the i386 portion of a binary with dead stripping turned on. The project compiles a lot of code, not all of which is used, and uses an export file to ensure that all the unused code is dead stripped. This is necessary as some of this code calls other routines that are not compiled into this target - without the export file the project doesn't link.

All this works perfectly well in the ppc build, but the i386 build fails due to an undefined symbols linker error. The undefined symbols listed are all those that are supposed to be dead-stripped.

Is there an explanation for this? Can anybody think of a good workaround? Note that splitting the unused (in this project) code into separate modules is not a practical solution.

To clarify here's an example:

main.cpp:
void ExportedFunction() // exported via the export file
{
	LibFunction();
}

lib.cpp:
void LibFunction()
{

}

void ShouldBeDeadStripped() // this function is not called from anything exported, so is dead stripped (except in i386!)
// (moving this function to another cpp file would solve the issue, but dead stripping should too)
{
UnavailableFunc(); // undefined symbol
SomethingThatWeCantLink(); // undefined symbol
}


Thanks in advance for any help,
Rua HM.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40adinstruments.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >dead stripping not working in intel build? (From: Rua Haszard Morris <email@hidden>)

  • Prev by Date: Re: dead-code stripping, pass two...
  • Next by Date: Re: dead-code stripping, pass two...
  • Previous by thread: dead stripping not working in intel build?
  • Next by thread: How to run an application bundle that dynamically loads a dylib
  • Index(es):
    • Date
    • Thread