diff --git a/Makefile b/Makefile
index fbfd2f93e784b87b970e7fdf6d5c00c54a9905a2..6797c8c12bcb0f77b07c11d59359bf888cda6f16 100644
--- a/Makefile
+++ b/Makefile
@@ -109,8 +109,8 @@ initcode: initcode.S
 	$(OBJCOPY) -S -O binary initcode.out initcode
 	$(OBJDUMP) -S initcode.o > initcode.asm
 
-kernel: $(OBJS) entry.o data.o entryother initcode
-	$(LD) $(LDFLAGS) -T kernel.ld -e entry -o kernel entry.o data.o $(OBJS) -b binary initcode entryother
+kernel: $(OBJS) entry.o entryother initcode
+	$(LD) $(LDFLAGS) -T kernel.ld -e entry -o kernel entry.o $(OBJS) -b binary initcode entryother
 	$(OBJDUMP) -S kernel > kernel.asm
 	$(OBJDUMP) -t kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym
 
@@ -121,8 +121,8 @@ kernel: $(OBJS) entry.o data.o entryother initcode
 # great for testing the kernel on real hardware without
 # needing a scratch disk.
 MEMFSOBJS = $(filter-out ide.o,$(OBJS)) memide.o
-kernelmemfs: $(MEMFSOBJS) entry.o data.o entryother initcode fs.img
-	$(LD) $(LDFLAGS) -Ttext 0x100000 -e main -o kernelmemfs entry.o data.o $(MEMFSOBJS) -b binary initcode entryother fs.img
+kernelmemfs: $(MEMFSOBJS) entry.o entryother initcode fs.img
+	$(LD) $(LDFLAGS) -Ttext 0x100000 -e main -o kernelmemfs entry.o  $(MEMFSOBJS) -b binary initcode entryother fs.img
 	$(OBJDUMP) -S kernelmemfs > kernelmemfs.asm
 	$(OBJDUMP) -t kernelmemfs | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernelmemfs.sym
 
diff --git a/data.S b/data.S
deleted file mode 100644
index 8b651b4de8ad3395683976a9affc25d7928da1ed..0000000000000000000000000000000000000000
--- a/data.S
+++ /dev/null
@@ -1,26 +0,0 @@
-// The kernel layout is:
-//
-//     text
-//     rodata
-//     data
-//     bss
-//
-// Conventionally, Unix linkers provide pseudo-symbols
-// etext, edata, and end, at the end of the text, data, and bss.
-// For the kernel mapping, we need the address at the beginning
-// of the data section, but that's not one of the conventional
-// symbols, because the convention started before there was a
-// read-only rodata section between text and data.
-//
-// To get the address of the data section, we define a symbol
-// named data and make sure this is the first object passed to
-// the linker, so that it will be the first symbol in the data section.
-//
-// Alternative approaches would be to parse our own ELF header
-// or to write a linker script, but this is simplest.
-
-.data
-.align 4096
-.globl data
-data:
-  .word 1
diff --git a/kernel.ld b/kernel.ld
index a778fc4b0f16ef47e888e30b6e5f208c5bec2148..e24c8601ab893eb39bee3e7db0967c3502dec33e 100644
--- a/kernel.ld
+++ b/kernel.ld
@@ -41,6 +41,14 @@ SECTIONS
 	/* Adjust the address for the data segment to the next page */
 	. = ALIGN(0x1000);
 
+	/* Conventionally, Unix linkers provide pseudo-symbols
+	 * etext, edata, and end, at the end of the text, data, and bss.
+	 * For the kernel mapping, we need the address at the beginning
+	 * of the data section, but that's not one of the conventional
+	 * symbols, because the convention started before there was a
+	 * read-only rodata section between text and data. */
+	PROVIDE(data = .);
+
 	/* The data segment */
 	.data : {
 		*(.data)
diff --git a/vm.c b/vm.c
index f2251acc8e7effdcff04f61155aa2020f0b58856..75fbc598a74da1d5d5400d15f069ec40abb5af20 100644
--- a/vm.c
+++ b/vm.c
@@ -7,7 +7,7 @@
 #include "proc.h"
 #include "elf.h"
 
-extern char data[];  // defined in data.S
+extern char data[];  // defined by kernel.ld
 pde_t *kpgdir;  // for use in scheduler()
 struct segdesc gdt[NSEGS];