Closed Bug 303984 Opened 19 years ago Closed 2 years ago

building a shared library ALWAYS requires -fPIC (and -DPIC)

Categories

(Core :: JavaScript Engine, defect)

All
FreeBSD
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: mi+mozilla, Unassigned)

Details

User-Agent:       Mozilla/5.0 (compatible; Konqueror/3.4; FreeBSD; X11; amd64) KHTML/3.4.1 (like Gecko)
Build Identifier: 

The config/Linux_All.mk only adds -DPIC -fPIC to OS_CFLAGS only in the case of 
amd64 (a.k.a. x86_64). These flags (Position Independent Code) should always be 
used to build a shared library. 
 
It just happens to work without it on i386... 
 
Other nits, that, probably, aren't worth their own "bug report": 
 
1) -lreadline is a standard part of the distribution of modern Linuxen and 
FreeBSD (other BSDs, probably, too). 
 
Linux_All.mk should use JS_READLINE instead of editline by default. People 
building their own js for binary-only releases can switch it back to the 
freely-licensed editline, but the default case should not pessimized. 
 
2) The js executable should be linking with the shared rather than static 
version of -ljs. This will make it closer to the embedded case allowing users 
an easier to way to investigate any embedding problems and saving the memory 
size by sharing the library's image between js and the embedding programs (such 
as the browsers). In fact, there, probably, is not even any need to ar together 
the static libjs.a at all. 
 
3) There is almost never a need to explicitly link with -lc. Not in js' case 
either. OS_LIBS should be just `-lm' (which replaces fdlibm). 

Reproducible: Always
Flags: testcase-
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: general → nobody
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.