• 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-code stripping, is it possible?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dead-code stripping, is it possible?


  • Subject: Re: dead-code stripping, is it possible?
  • From: Chris Ridd <email@hidden>
  • Date: Wed, 02 Jun 2004 20:29:45 +0100

On 2/6/04 6:54 pm, Daniel Jogvan Nielsen <email@hidden> wrote:

> As I understand "symbols" then it means functions, objects and more,
> and not just "modules"
>
> Please correct me if I'm wrong.

No, a symbol is just a name (of a function, class, global variable, etc). If
you strip the symbol the object referenced by it is left in the binary.

This is testable:

[titanium:~] cjr% cat test.c
extern const char *foo;
extern int func(void);

const char *foo = "Hello world";

int func(void)
{
        return 100;
}
[titanium:~] cjr% cat testmain.c
#include <stdio.h>

extern int func(void);

int main(void)
{
        printf("Main %d\n", func());
        return 0;
}
[titanium:~] cjr% gcc -c test.c testmain.c
[titanium:~] cjr% ar cru libtest.a test.o
[titanium:~] cjr% ranlib libtest.a
[titanium:~] cjr% gcc -o testmain testmain.o -L. -ltest
[titanium:~] cjr% ./testmain
Main 100
[titanium:~] cjr% strings testmain
__dyld_mod_term_funcs
__dyld_make_delayed_module_initializer_calls
The kernel support for the dynamic linker is not present to run this
program.
Main %d
Hello world
[titanium:~] cjr% strip testmain
[titanium:~] cjr% strings testmain
__dyld_mod_term_funcs
__dyld_make_delayed_module_initializer_calls
The kernel support for the dynamic linker is not present to run this
program.
Main %d
Hello world

In other words, the constant string is in a referenced module but still in
the binary even though it is not itself referenced and the binary's been
stripped.

Cheers,

Chris
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: dead-code stripping, is it possible? (From: Daniel Jogvan Nielsen <email@hidden>)

  • Prev by Date: Re: very sluggish editing
  • Next by Date: Re: Smart groups and regex
  • Previous by thread: Re: dead-code stripping, is it possible?
  • Next by thread: Re: dead-code stripping, is it possible?
  • Index(es):
    • Date
    • Thread