Skip to content

Commit

Permalink
LD scripts subdir
Browse files Browse the repository at this point in the history
  • Loading branch information
djphoenix committed Nov 3, 2016
1 parent bd98da3 commit 0c9b192
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion ld-mod.script → ld/module.ld
Expand Up @@ -16,6 +16,7 @@
*/

OUTPUT_FORMAT(elf64-x86-64)
ENTRY(module)
SECTIONS
{
.text BLOCK(1) : ALIGN(1) {
Expand All @@ -24,9 +25,11 @@ SECTIONS
*(.gnu.linkonce.t.*)
*(.fini)
}
.data BLOCK(1) : ALIGN(1) {
.rodata BLOCK(1) : ALIGN(1) {
*(.init_array*)
*(.rodata .rodata.* .rdata .rdata.*)
}
.data BLOCK(1) : ALIGN(1) {
*(.data .data.*)
*(.xdata .xdata.* .pdata .pdata.*)
}
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions makefiles/rules.mk
Expand Up @@ -8,7 +8,7 @@ endif
$(BIN).elf: $(OBJECTS) $(OOBJDIR)/modules-linked.o
@ mkdir -p $(dir $@)
$(QECHO) LD $(subst $(OIMGDIR)/,,$@)
$(Q) $(CC) $(CFLAGS) -Tld.script -o $@ -Wl,--start-group $^ -Wl,--end-group
$(Q) $(CC) $(CFLAGS) -Lld -Tsystem.ld -o $@ -Wl,--start-group $^ -Wl,--end-group

$(BIN).elf.strip: $(BIN).elf
$(Q) $(STRIP) -o $@ $^
Expand Down Expand Up @@ -41,7 +41,7 @@ $(OOBJDIR)/%.o: $(SRCDIR)/%.s
$(OMODDIR)/%.o: $(OOBJDIR)/mod_%.o
@ mkdir -p $(dir $@)
$(QECHO) MODLD $(@:$(OMODDIR)/%.o=%)
$(Q) $(CC) $(CFLAGS) -Tld-mod.script -r -o $@ -s $^
$(Q) $(CC) $(CFLAGS) -shared -Lld -Tmodule.ld -r -o $@ -s $^

$(OOBJDIR)/modules-linked.o: $(MODOBJS)
@ mkdir -p $(dir $@)
Expand Down

0 comments on commit 0c9b192

Please sign in to comment.