Skip to content
Snippets Groups Projects
Commit b45fb97e authored by agoncharov's avatar agoncharov
Browse files

WIP: a run on EXECUTABLE for FreeBSD

parent 6d513f3f
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@
* Much hacked by Paul Werkowski
* GENCGC support by Douglas Crosher, 1996, 1997.
*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/FreeBSD-os.c,v 1.34 2010/06/27 13:17:17 rtoy Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/FreeBSD-os.c,v 1.35 2010/09/07 03:56:38 agoncharov Exp $
*
*/
......@@ -307,6 +307,12 @@ os_install_interrupt_handlers(void)
void *
os_dlsym(const char *sym_name, lispobj lib_list)
{
static void *program_handle;
void *sym_addr = 0;
if (!program_handle)
program_handle = dlopen((void *) 0, RTLD_LAZY | RTLD_GLOBAL);
if (lib_list != NIL) {
lispobj lib_list_head;
......@@ -320,8 +326,7 @@ os_dlsym(const char *sym_name, lispobj lib_list)
return sym_addr;
}
}
return dlsym(RTLD_DEFAULT, sym_name);
return dlsym(program_handle, sym_name);
}
void
......
/* Script of linker directives for building Lisp executables with CMU
Lisp. Derived from GNU linker script. For FreeBSD 5.
$Id: FreeBSD-cmucl-linker-script,v 1.1 2007/07/07 16:04:34 fgilham Rel $
*/
/* -*- mode: c; -*-
* Linker directives for building Lisp executables with CMUCL on FreeBSD 8.x.
*
* Obtain via:
*
* * ld --verbose > tools/FreeBSD-cmucl-linker-script
* * Remove the === header and footer
* * Paste "Lisp core sections" (the three COR* lines before "Stabs debugging sections"
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/tools/Attic/FreeBSD-cmucl-linker-script,v 1.2 2010/09/07 03:56:38 agoncharov Exp $
*
*/
/* Script for -z combreloc: combine and sort reloc sections */
OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd",
"elf32-i386-freebsd")
OUTPUT_ARCH(i386)
ENTRY(_start)
PHDRS
{
headers PT_PHDR PHDRS ;
interp PT_INTERP ;
text PT_LOAD FILEHDR PHDRS ;
data PT_LOAD ;
dynamic PT_DYNAMIC ;
note PT_NOTE ;
/* Add core sections for Lisp. */
CORRO PT_NOTE ;
CORSTA PT_NOTE ;
CORDYN PT_NOTE ;
}
SEARCH_DIR("/usr/lib");
SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
/* Do we need any of these for elf?
__DYNAMIC = 0; */
SECTIONS
{
/* Read-only sections, merged into text segment: */
. = 0x08048000 + SIZEOF_HEADERS;
.interp : { *(.interp) } :interp :text
.note.ABI-tag : { *(.note.ABI-tag) } :text :note
.hash : { *(.hash) } :text
.dynsym : { *(.dynsym) } :text
.dynstr : { *(.dynstr) } :text
/* PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + SIZEOF_HEADERS; */
PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + 52 + 10*32;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
......@@ -54,7 +44,7 @@ SECTIONS
*(.rel.dtors)
*(.rel.got)
*(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
} :text
}
.rela.dyn :
{
*(.rela.init)
......@@ -69,12 +59,12 @@ SECTIONS
*(.rela.got)
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
}
.rel.plt : { *(.rel.plt) } :text
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.init :
{
KEEP (*(.init))
} :text =0x90909090
} =0x90909090
.plt : { *(.plt) }
.text :
{
......@@ -91,10 +81,10 @@ SECTIONS
PROVIDE (etext = .);
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
.eh_frame_hdr : { *(.eh_frame_hdr) } :data
.eh_frame_hdr : { *(.eh_frame_hdr) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = DATA_SEGMENT_ALIGN(0x1000, 0x1000);
. = ALIGN (0x1000) - ((0x1000 - .) & (0x1000 - 1)); . = DATA_SEGMENT_ALIGN (0x1000, 0x1000);
/* Ensure the __preinit_array_start label is properly aligned. We
could instead move the label definition inside the section, but
the linker would then create the section even if it turns out to
......@@ -117,9 +107,9 @@ SECTIONS
.data1 : { *(.data1) }
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
.eh_frame : { KEEP (*(.eh_frame)) } :data
.eh_frame : { KEEP (*(.eh_frame)) }
.gcc_except_table : { *(.gcc_except_table) }
.dynamic : { *(.dynamic) } :data :dynamic
.dynamic : { *(.dynamic) }
.ctors :
{
/* gcc uses crtbegin.o to find the start of
......@@ -131,19 +121,19 @@ SECTIONS
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*crtbegin*.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
} :data
}
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
KEEP (*crtbegin*.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
......@@ -168,9 +158,9 @@ SECTIONS
. = DATA_SEGMENT_END (.);
/* Lisp core sections. */
CORRO 0x10000000 : { CORRO.o (CORRO) } :CORRO
CORSTA 0x28f00000 : { CORSTA.o (CORSTA) } :CORSTA
CORDYN 0x48000000 : { CORDYN.o (CORDYN) } :CORDYN
CORRO 0x10000000 : { CORRO.o (CORRO) }
CORSTA 0x28f00000 : { CORSTA.o (CORSTA) }
CORDYN 0x48000000 : { CORDYN.o (CORDYN) }
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
......@@ -205,4 +195,5 @@ SECTIONS
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/DISCARD/ : { *(.note.GNU-stack) }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment