[PATCH,take2] Add plugin interface to LD, respun. [1..6/6]

Dave Korn dave.korn.cygwin@gmail.com
Mon Oct 11 17:52:00 GMT 2010


On 11/10/2010 18:22, Richard Henderson wrote:

> Without --enable-plugins:
> 
> ../../git-binu/ld/ldmain.c: In function ‘add_archive_element’:
> ../../git-binu/ld/ldmain.c:800: error: unused variable ‘fildes’
> ../../git-binu/ld/ldmain.c:796: error: unused parameter ‘subsbfd’
> 
> which can be fixed in the obvious way.
> 
> With --enable-plugins (x86_64-linux):

  Err, I think the first thing I have to do is figure out why --enable-plugins
makes a difference at all considering I removed the AC_ARG_ENABLE!  It should
all be automatic based on the availability of dlfcn.h, and the linkability of
dlopen/dlsym/dlclose.

> libtool: link: gcc -shared  .libs/libldtestplug_la-testplug.o   -ldl  ../libiberty/libiberty.a   -Wl,-soname -Wl,libldtestplug.so.0 -o .libs/libldtestplug.so.0.0.0
> /usr/bin/ld: ../libiberty/libiberty.a(xmalloc.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

  Eeep!

> It may be easier to avoid libiberty in the test plugin than to 
> work out how to coordinate -fpic over there without libtool too.

  Yes, I think you're right, particularly considering:

> For testing purposes, I just built the libiberty directory with
> -fpic added manually.  At which point I get
> 
> Running /local/rth/gcc/git-binu/ld/testsuite/ld-plugin/plugin.exp ...
> ERROR: tcl error sourcing /local/rth/gcc/git-binu/ld/testsuite/ld-plugin/plugin.exp.

... this must be some sort of run path problem.

>>  ldfile_try_open_bfd (const char *attempt,
>>                      lang_input_statement_type *entry)
>>  {
>> +#ifdef ENABLE_PLUGINS
>> +  int fildes;
>> +#endif /* ENABLE_PLUGINS */
> 
> Please move that down to the use and add { }.

  Oops, missed one.  I'll factor the ternary that sets it into an if() to
provide a scope.

    cheers,
      DaveK



More information about the Binutils mailing list