[lld] r212094 - [mach-o]: make the default dylib install-name the output filename.
Rafael Avila de Espindola
rafael.espindola at gmail.com
Wed Jul 2 11:38:30 PDT 2014
Why macho-dump? We try to use llvm-readobj for all new tests.
Sent from my iPhone
> On Jul 1, 2014, at 4:41, Tim Northover <tnorthover at apple.com> wrote:
>
> Author: tnorthover
> Date: Tue Jul 1 03:41:45 2014
> New Revision: 212094
>
> URL: http://llvm.org/viewvc/llvm-project?rev=212094&view=rev
> Log:
> [mach-o]: make the default dylib install-name the output filename.
>
> Modified:
> lld/trunk/lib/Driver/DarwinLdDriver.cpp
> lld/trunk/test/mach-o/dylib-install-names.yaml
>
> Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=212094&r1=212093&r2=212094&view=diff
> ==============================================================================
> --- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
> +++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Tue Jul 1 03:41:45 2014
> @@ -191,6 +191,8 @@ bool DarwinLdDriver::parse(int argc, con
> // Handle -o xxx
> if (llvm::opt::Arg *outpath = parsedArgs->getLastArg(OPT_output))
> ctx.setOutputPath(outpath->getValue());
> + else
> + ctx.setOutputPath("a.out");
>
> // Handle -dead_strip
> if (parsedArgs->getLastArg(OPT_dead_strip))
> @@ -203,6 +205,8 @@ bool DarwinLdDriver::parse(int argc, con
> // Handle -install_name
> if (llvm::opt::Arg *installName = parsedArgs->getLastArg(OPT_install_name))
> ctx.setInstallName(installName->getValue());
> + else
> + ctx.setInstallName(ctx.outputPath());
>
> // Handle -mark_dead_strippable_dylib
> if (parsedArgs->getLastArg(OPT_mark_dead_strippable_dylib))
>
> Modified: lld/trunk/test/mach-o/dylib-install-names.yaml
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/dylib-install-names.yaml?rev=212094&r1=212093&r2=212094&view=diff
> ==============================================================================
> --- lld/trunk/test/mach-o/dylib-install-names.yaml (original)
> +++ lld/trunk/test/mach-o/dylib-install-names.yaml Tue Jul 1 03:41:45 2014
> @@ -1,7 +1,20 @@
> +# Check we accept -install_name correctly:
> # RUN: lld -flavor darwin -arch x86_64 -install_name libwibble.dylib -dylib %s -o %t.dylib
> # RUN: macho-dump %t.dylib | FileCheck %s --check-prefix=CHECK-BINARY-WRITE
> +
> +# Check we read LC_ID_DYLIB correctly:
> # RUN: lld -flavor darwin -arch x86_64 %p/Inputs/use-dylib-install-names.yaml %t.dylib -r -print_atoms | FileCheck %s --check-prefix=CHECK-BINARY-READ
>
> +# Check we default the install-name to the output file:
> +# RUN: lld -flavor darwin -arch x86_64 -dylib %s -o libwibble.dylib
> +# RUN: macho-dump libwibble.dylib | FileCheck %s --check-prefix=CHECK-BINARY-WRITE
> +# RUN: rm -f libwibble.dylib
> +
> +# Check the default output file is a.out, and this also goes into LC_ID_DYLIB.
> +# RUN: lld -flavor darwin -arch x86_64 -dylib %s
> +# RUN: macho-dump a.out | FileCheck %s --check-prefix=CHECK-BINARY-WRITE-AOUT
> +# RUN: rm -f a.out
> +
> --- !mach-o
> arch: x86_64
> file-type: MH_OBJECT
> @@ -36,6 +49,10 @@ global-symbols:
> # CHECK-BINARY-WRITE-NEXT: ('size', 40)
> # CHECK-BINARY-WRITE-NEXT: ('install_name', 'libwibble.dylib')
>
> +# CHECK-BINARY-WRITE-AOUT: (('command', 13)
> +# CHECK-BINARY-WRITE-AOUT-NEXT: ('size', 32)
> +# CHECK-BINARY-WRITE-AOUT-NEXT: ('install_name', 'a.out')
> +
> # CHECK-BINARY-READ: shared-library-atoms:
> # CHECK-BINARY-READ: - name: _myGlobal
> # CHECK-BINARY-READ: load-name: libwibble.dylib
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list