public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld -shared support
@ 2020-02-23  4:02 William Tambe
  2020-02-23 20:44 ` William Tambe
  0 siblings, 1 reply; 5+ messages in thread
From: William Tambe @ 2020-02-23  4:02 UTC (permalink / raw)
  To: Binutils

What needs to be done to support -shared in the link-editor ?

Is there a commit that describe how to support -shared ?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ld -shared support
  2020-02-23  4:02 ld -shared support William Tambe
@ 2020-02-23 20:44 ` William Tambe
  2020-02-25 17:14   ` William Tambe
  0 siblings, 1 reply; 5+ messages in thread
From: William Tambe @ 2020-02-23 20:44 UTC (permalink / raw)
  To: Binutils

I am now able to use ld -shared after using:
GENERATE_SHLIB_SCRIPT=yes

However when compiling a test shared library using:
gcc -shared -o test.so test.c
The following error occur:
crt0.o: error adding symbols: no error

The linker is successfully able to open crt0.o printing the following
when using -verbose:
attempt to open crt0.o succeeded

Any idea what might be missing ?

On Sat, Feb 22, 2020 at 11:02 PM William Tambe <tambewilliam@gmail.com> wrote:
>
> What needs to be done to support -shared in the link-editor ?
>
> Is there a commit that describe how to support -shared ?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ld -shared support
  2020-02-23 20:44 ` William Tambe
@ 2020-02-25 17:14   ` William Tambe
  2020-02-27 13:24     ` William Tambe
  0 siblings, 1 reply; 5+ messages in thread
From: William Tambe @ 2020-02-25 17:14 UTC (permalink / raw)
  To: Binutils

On Sun, Feb 23, 2020 at 3:44 PM William Tambe <tambewilliam@gmail.com> wrote:
>
> I am now able to use ld -shared after using:
> GENERATE_SHLIB_SCRIPT=yes
>
> However when compiling a test shared library using:
> gcc -shared -o test.so test.c
> The following error occur:
> crt0.o: error adding symbols: no error

Any idea ?

>
> The linker is successfully able to open crt0.o printing the following
> when using -verbose:
> attempt to open crt0.o succeeded
>
> Any idea what might be missing ?
>
> On Sat, Feb 22, 2020 at 11:02 PM William Tambe <tambewilliam@gmail.com> wrote:
> >
> > What needs to be done to support -shared in the link-editor ?
> >
> > Is there a commit that describe how to support -shared ?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ld -shared support
  2020-02-25 17:14   ` William Tambe
@ 2020-02-27 13:24     ` William Tambe
  2020-03-02 17:28       ` Nick Clifton
  0 siblings, 1 reply; 5+ messages in thread
From: William Tambe @ 2020-02-27 13:24 UTC (permalink / raw)
  To: Binutils

I have enabled the macro elf_backend_create_dynamic_sections in the
elf32-xxxx.c BFD support file and I am able to make progress still
with failures.

Can anyone describe the meaning of enabling the following macros ?

#define elf_backend_rela_normal
#define elf_backend_can_refcount
#define elf_backend_plt_readonly
#define elf_backend_want_got_sym
#define elf_backend_want_plt_sym
#define elf_backend_want_dynrelro
#define elf_backend_got_header_size
#define elf_backend_want_got_plt


On Tue, Feb 25, 2020 at 12:13 PM William Tambe <tambewilliam@gmail.com> wrote:
>
> On Sun, Feb 23, 2020 at 3:44 PM William Tambe <tambewilliam@gmail.com> wrote:
> >
> > I am now able to use ld -shared after using:
> > GENERATE_SHLIB_SCRIPT=yes
> >
> > However when compiling a test shared library using:
> > gcc -shared -o test.so test.c
> > The following error occur:
> > crt0.o: error adding symbols: no error
>
> Any idea ?
>
> >
> > The linker is successfully able to open crt0.o printing the following
> > when using -verbose:
> > attempt to open crt0.o succeeded
> >
> > Any idea what might be missing ?
> >
> > On Sat, Feb 22, 2020 at 11:02 PM William Tambe <tambewilliam@gmail.com> wrote:
> > >
> > > What needs to be done to support -shared in the link-editor ?
> > >
> > > Is there a commit that describe how to support -shared ?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ld -shared support
  2020-02-27 13:24     ` William Tambe
@ 2020-03-02 17:28       ` Nick Clifton
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Clifton @ 2020-03-02 17:28 UTC (permalink / raw)
  To: William Tambe, Binutils

Hi William,

> Can anyone describe the meaning of enabling the following macros ?
> 
> #define elf_backend_rela_normal
> #define elf_backend_can_refcount
> #define elf_backend_plt_readonly
> #define elf_backend_want_got_sym
> #define elf_backend_want_plt_sym
> #define elf_backend_want_dynrelro
> #define elf_backend_got_header_size
> #define elf_backend_want_got_plt
> 

Sadly internal documentation for the binutils is sadly lacking.
The best method is to look for how these macros are used in the
code itself.

So for example elf_backend_rela_normal is used in bfd/elflink.c
to determine is the addend in RELA type relocs should be adjusted 
when performing a relocatable link.  Most backends set the default
for this field to 1, but there are some that do not.  In order to
decide what to do, you need to consult the ABI for your architecture.
If you are actually creating the ABI, then you get to choose, and
probably going with the majority of other ports - and setting the
value to 1 - will be a good idea.

You can perform similar investigations for the other macros.
If you are having trouble understanding their operation howrver
please do feel free to post to this list again.

Cheers
  Nick


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-02 17:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-23  4:02 ld -shared support William Tambe
2020-02-23 20:44 ` William Tambe
2020-02-25 17:14   ` William Tambe
2020-02-27 13:24     ` William Tambe
2020-03-02 17:28       ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).