What exactly does "ld -z text" do?
From: Peestrus (peestrus_at_peestrus.freewebspace.com)
Date: 05/05/03
- Next message: Andy Isaacson: "Re: Computing core file size before calling abort?"
- Previous message: Jordan Bettis: "Re: threads vs. processes"
- Next in thread: Paul Pluzhnikov: "Re: What exactly does "ld -z text" do?"
- Reply: Paul Pluzhnikov: "Re: What exactly does "ld -z text" do?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 5 May 2003 10:03:12 -0700
Hello,
I have a shared library that compiles only if the "-z text" flag is
not present at the linker command line (I am using SCO OpenServer
v5.0.5); however my compiler (gcc 2.95) seems to pass this flag to the
linker. What does this flag do exactly? The man page says: "-z text:
force a fatal error if any relocations against non-writable,
allocatable sections remain", but I have no idea what that means. I
can still build it without "-z text", but *can* I omit it safely?
Here is what I get:
--- [foo.c]
#include <math.h>
int foo() { return ( int ) sqrt( 1.0 ); }
---
% gcc -o foo.o foo.c
% ld -G -o libfoo.so foo.o -lm -lc
% ld -G -o -z text libfoo.so -lm -lc
relocations referenced
from file(s)
foo.o
/usr/ccs/lib/libm.a(sqrt.o)
/usr/ccs/lib/libm.a(merr.o)
fatal error: relocations remain against allocatable but non-writable
section: .text
% g++ -shared -o libfoo.so foo.c
relocations referenced
from file(s)
foo.o
/usr/ccs/lib/libm.a(sqrt.o)
/usr/ccs/lib/libm.a(merr.o)
fatal error: relocations remain against allocatable but non-writable
section: .text
D.P.
- Next message: Andy Isaacson: "Re: Computing core file size before calling abort?"
- Previous message: Jordan Bettis: "Re: threads vs. processes"
- Next in thread: Paul Pluzhnikov: "Re: What exactly does "ld -z text" do?"
- Reply: Paul Pluzhnikov: "Re: What exactly does "ld -z text" do?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]