• 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
[Retry] Apple cctools ld Failure
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Retry] Apple cctools ld Failure


  • Subject: [Retry] Apple cctools ld Failure
  • From: Martin Fong <email@hidden>
  • Date: Tue, 16 Aug 2005 11:42:08 -0700

       Enclosed is a test that demonstrates a problem with Apple's ld
failing to load a library module when a global variable is the only
external reference.  (This problem does _not_ occur with GNU's ld.)
Diagnostic output from various (disparate) compiler/linker pairings
follow.

       Any suggestions, or should I simply file a bug report?

       Thanks!

       ...Martin

--- Failed Test with Apple's ld ---

% ./ld_test.csh
gcc (GCC) 3.3 20030304 (Apple Computer, Inc. build 1671)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

Apple Computer, Inc. version cctools-525.1.obj~8

Compiling loader test components...
First test: load .o files...

Creating declaration library...
Second test: load with .a file...
ld: Undefined symbols:
_my_opt

Third test: load with .a file and invoke dummy_proc ()...
           U _dummy_proc

--- Successful Test 1 ---

% ./ld_test.csh
2.95.4
GNU ld version 2.11 (with BFD 2.11)

Compiling loader test components...
First test: load .o files...

Creating declaration library...
Second test: load with .a file...

Third test: load with .a file and invoke dummy_proc ()...
           U dummy_proc

--- Successful Test 2 ---

$ ./ld_test.csh
gcc (GCC) 3.4.3 20050227 (Red Hat 3.4.3-22.fc3)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

GNU ld version 2.15.92.0.2 20040927

Compiling loader test components...
First test: load .o files...

Creating declaration library...
Second test: load with .a file...

Third test: load with .a file and invoke dummy_proc ()...
                   U dummy_proc

--- Successful Test 3 ---

$ ./ld_test.csh
2.95.3
GNU ld version 2.13.1

Compiling loader test components...
First test: load .o files...

Creating declaration library...
Second test: load with .a file...

Third test: load with .a file and invoke dummy_proc ()...
           U dummy_proc

========= Test code 1/3: ld_test.csh ==========

#!/bin/csh -f

gcc --version
ld -v
echo ""

echo "Compiling loader test components..."
gcc ld_ref.c -c -o ld_ref.o
gcc ld_dec.c -c -o ld_dec.o

echo "First test: load .o files..."
gcc ld_ref.o ld_dec.o -o ld_ref
echo ""

echo "Creating declaration library..."
rm -f ld_dec.a >& /dev/null
ar cru ld_dec.a ld_dec.o
ranlib ld_dec.a

echo "Second test: load with .a file..."
gcc ld_ref.o ld_dec.a -o ld_ref
echo ""

echo "Third test: load with .a file and invoke dummy_proc ()..."
gcc ld_ref.c -c -DREF_PROC -o ld_ref.o
nm ld_ref.o | grep dummy_proc
gcc ld_ref.o ld_dec.a -o ld_ref

rm -f ld_ref >& /dev/null

========= Test code 2/3: ld_ref.c ==========

  int
main (int argc, char **argv)
{
  extern int my_opt;

  my_opt = 0;

#if defined (REF_PROC)
  {
    extern int dummy_proc (void);

    (void) dummy_proc ();
  }
#endif

  return 0;
}

========= Test code 3/3: ld_dec.c ==========

int my_opt;

  int
dummy_proc (void)
{
  return 0;
}
_______________________________________________
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


  • Follow-Ups:
    • Re: [Retry] Apple cctools ld Failure
      • From: Eric Albert <email@hidden>
  • Prev by Date: Static data member behaviour in release builds
  • Next by Date: Re: [Retry] Apple cctools ld Failure
  • Previous by thread: Re: Static data member behaviour in release builds
  • Next by thread: Re: [Retry] Apple cctools ld Failure
  • Index(es):
    • Date
    • Thread