Unix Programming - DT_TEXTREL

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > June 2006 > DT_TEXTREL





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author DT_TEXTREL
Ykstort

2006-06-12, 7:23 pm

When I compile a module liek this:
gcc -shared -fPIC -o foobarbaz.so foo.o bar.o baz.o
I get this:
/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../../i686-pc-linux-gnu/bin/ld:
warning: creating a DT_TEXTREL in object.

Frank Cusack

2006-06-13, 1:31 am

On 12 Jun 2006 17:07:24 -0700 "Ykstort" <ykstortionist@gmail.com> wrote:
> When I compile a module liek this:
> gcc -shared -fPIC -o foobarbaz.so foo.o bar.o baz.o
> I get this:
> /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../../i686-pc-linux-gnu/bin/ld:
> warning: creating a DT_TEXTREL in object.


cool.
Ykstort

2006-06-13, 1:31 am


Frank Cusack wrote:
> On 12 Jun 2006 17:07:24 -0700 "Ykstort" <ykstortionist@gmail.com> wrote:
>
> cool.

0.o
What kind of useless comment is that ?
Maybe I should have been clearer when I started the topic: why do I get
that warning and is it bad ?

Paul Pluzhnikov

2006-06-13, 1:31 am

"Ykstort" <ykstortionist@gmail.com> writes:

> Frank Cusack wrote:
> 0.o
> What kind of useless comment is that ?


It rather fits the original post.

> Maybe I should have been clearer when I started the topic: why do I get
> that warning


You probably didn't compile foo.o, bar.o or baz.o with -fPIC like
you should have.

> and is it bad ?


Probably. DT_TEXTREL likely means that you have .text relocations
remaining, which will make your DSO "unsharead" as soon as it is
loaded into a process address space.

On some platforms (e.g. SPARC, x86_64) the linker will flat refuse
to build DSO from non-PIC code. On x86 the linker allows this.

This is the first time I see a warning about it. Which version of
linker produced that warning?

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Ykstort

2006-06-13, 1:31 am


Paul Pluzhnikov wrote:
> "Ykstort" <ykstortionist@gmail.com> writes:
>
>
> It rather fits the original post.
>
>
> You probably didn't compile foo.o, bar.o or baz.o with -fPIC like
> you should have.
>
>
> Probably. DT_TEXTREL likely means that you have .text relocations
> remaining, which will make your DSO "unsharead" as soon as it is
> loaded into a process address space.
>
> On some platforms (e.g. SPARC, x86_64) the linker will flat refuse
> to build DSO from non-PIC code. On x86 the linker allows this.
>
> This is the first time I see a warning about it. Which version of
> linker produced that warning?

Well I'm using -fPIC
It's gcc version 3.4.6-r1
>
> Cheers,
> --
> In order to understand recursion you must first understand recursion.
> Remove /-nsp/ for email.


Paul Pluzhnikov

2006-06-13, 1:31 am

"Ykstort" <ykstortionist@gmail.com> writes:

> Well I'm using -fPIC


Not likely. We can see that you use -fPIC at link time (when it
doesn't matter); but are you using it at *compile* time?

> It's gcc version 3.4.6-r1


You continue the pattern of supplying minimal and wrong info,
and you are unlikely to get good answers because of that.

I asked you: "which version of *linker* produced the warning?"
The version of gcc is irrelevant. Perhaps you don't understand
the difference between linker and compiler?

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Ykstort

2006-06-13, 1:31 am


Paul Pluzhnikov wrote:
> "Ykstort" <ykstortionist@gmail.com> writes:
>
>
> Not likely. We can see that you use -fPIC at link time (when it
> doesn't matter); but are you using it at *compile* time?


Oh you need it when you compile too ?
That would explain it then
>
>
> You continue the pattern of supplying minimal and wrong info,
> and you are unlikely to get good answers because of that.
>
> I asked you: "which version of *linker* produced the warning?"
> The version of gcc is irrelevant. Perhaps you don't understand
> the difference between linker and compiler?


Although it no longer matters as compiling with -fPIC fixed the
problem, it was GNU ld version 2.16.1
Sorry about the confusion
>
> Cheers,
> --
> In order to understand recursion you must first understand recursion.
> Remove /-nsp/ for email.


Barry Margolin

2006-06-13, 7:31 am

In article <1150180260.975427.192290@u72g2000cwu.googlegroups.com>,
"Ykstort" <ykstortionist@gmail.com> wrote:

> Paul Pluzhnikov wrote:
>
> Oh you need it when you compile too ?


When else would you need it? -fPIC means "generate position-independent
code". Since only the compiler generates code, it's meaningless any
other time.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com