aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-07-09 10:48:57 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-07-09 10:48:57 -0700
commit0b4b1529f14037c5a4d61cf90b010464170b6d2a (patch)
tree9e181302cb170fd0ce42164897e62f607fed467a
parent2df91af910aa3f4e127837b907395758c3e5be14 (diff)
downloadpxelinux-0b4b1529f14037c5a4d61cf90b010464170b6d2a.tar.gz
pxelinux-0b4b1529f14037c5a4d61cf90b010464170b6d2a.tar.xz
pxelinux-0b4b1529f14037c5a4d61cf90b010464170b6d2a.zip
core: include exported symbol information
Extract symbol table information to be exported to modules. This is a really hacky way of doing it, so replace it later. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/Makefile15
-rw-r--r--core/symbols.S5
-rw-r--r--core/syslinux.ld10
3 files changed, 27 insertions, 3 deletions
diff --git a/core/Makefile b/core/Makefile
index c4bcbd47..13d07664 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -41,7 +41,7 @@ BTARGET = kwdhash.gen \
NASMSRC := $(wildcard *.asm)
NASMHDR := $(wildcard *.inc)
CSRC := $(wildcard *.c)
-SSRC := $(wildcard *.S lzo/*.S)
+SSRC := $(filter-out symbols.S,$(wildcard *.S lzo/*.S))
CHDR := $(wildcard *.h)
OTHERSRC := keywords
ALLSRC = $(NASMSRC) $(NASMHDR) $(CSRC) $(SSRC) $(CHDR) $(OTHERSRC)
@@ -86,8 +86,16 @@ kwdhash.gen: keywords genhash.pl
-DHEXDATE="$(HEXDATE)" \
-l $(@:.o=.lsr) -o $@ -MP -MD .$@.d $<
-%.elf: %.o $(LIBS) syslinux.ld
- $(LD) $(LDFLAGS) -T syslinux.ld -M -o $@ $< $(LIBS) > $(@:.elf=.map)
+%.elf: %.o $(LIBS) syslinux.ld symbols.S
+ $(LD) $(LDFLAGS) -T syslinux.ld -o $*.elf.tmp $< $(LIBS)
+ $(OBJCOPY) -x --extract-symbol $*.elf.tmp $*.sym
+ $(CC) $(CFLAGS) -DSYMFILE=\"$*.sym\" -c -o $*.sym.o symbols.S
+ $(LD) $(LDFLAGS) -T syslinux.ld -o $*.elf.tmp $< $*.sym.o $(LIBS)
+ $(OBJCOPY) -x --extract-symbol $*.elf.tmp $*.sym
+ $(CC) $(CFLAGS) -DSYMFILE=\"$*.sym\" -c -o $*.sym.o symbols.S
+ $(LD) $(LDFLAGS) -T syslinux.ld -M -o $@ $< $*.sym.o $(LIBS) \
+ > $(@:.elf=.map)
+ -rm -f $*.elf.tmp
$(OBJDUMP) -h $@ > $(@:.elf=.sec)
$(PERL) lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst)
@@ -127,6 +135,7 @@ netinstall: installer
tidy dist:
rm -f codepage.cp *.o *.elf *.a stupid.* patch.offset .depend .*.d
+ rm -f *.elf.tmp *.sym
rm -f *.lsr *.lst *.map *.sec *.raw
rm -f */*.o */*.lst */.*.d
rm -f $(OBSOLETE)
diff --git a/core/symbols.S b/core/symbols.S
new file mode 100644
index 00000000..00cd3e80
--- /dev/null
+++ b/core/symbols.S
@@ -0,0 +1,5 @@
+ .section ".dynlink","a"
+_dynamic_symbols:
+ .globl _dynamic_symbols
+ .incbin SYMFILE
+ .size _dynamic_symbols, .-_dynamic_symbols
diff --git a/core/syslinux.ld b/core/syslinux.ld
index 4906ce4a..3032dd2d 100644
--- a/core/syslinux.ld
+++ b/core/syslinux.ld
@@ -260,6 +260,16 @@ SECTIONS
. = ALIGN(4);
+ __dynlink_vma = .;
+ __dynlink_lma = __dynlink_vma + __text_lma - __text_vma;
+ .dynlink : AT(__dynlink_lma) {
+ __dynlink_start = .;
+ *(.dynlink)
+ __dynlink_end = .;
+ }
+
+ . = ALIGN(4);
+
__got_vma = .;
__got_lma = __got_vma + __text_lma - __text_vma;
.got : AT(__got_lma) {