mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-19 19:26:29 +00:00
os: reenable -fPIC and fix policy linkerscript
As it turns out using -fPIC was not the issue but discarding certain sections. The policy_module_table is now located in .data.rel which needs to be at the beginning of the binary. Fixes #849.
This commit is contained in:
parent
5afb5fcc12
commit
d2f7c7bec4
@ -4,7 +4,7 @@
|
|||||||
# \date 2013-08-12
|
# \date 2013-08-12
|
||||||
#
|
#
|
||||||
|
|
||||||
CXX_OPT = -g -ffreestanding -fno-exceptions -fno-rtti -nostdinc -nostdlib
|
CXX_OPT = -g -ffreestanding -fPIC -fno-exceptions -fno-rtti -nostdinc -nostdlib -MMD
|
||||||
|
|
||||||
LD_SCRIPT= $(PRG_DIR)/../policy.ld
|
LD_SCRIPT= $(PRG_DIR)/../policy.ld
|
||||||
|
|
||||||
@ -23,7 +23,8 @@ policy.o: policy.cc
|
|||||||
|
|
||||||
$(TARGET_POLICY).elf: table.o policy.o
|
$(TARGET_POLICY).elf: table.o policy.o
|
||||||
$(MSG_LINK)$@
|
$(MSG_LINK)$@
|
||||||
$(VERBOSE)$(LD) $(LD_MARCH) -T $(LD_SCRIPT) -Ttext=0 $^ -o $@
|
$(VERBOSE)$(LD) $(LD_MARCH) -T $(LD_SCRIPT) -Ttext=0 \
|
||||||
|
$^ $(shell $(CXX) $(CC_MARCH) -print-libgcc-file-name) -o $@
|
||||||
|
|
||||||
$(INSTALL_DIR)/$(TARGET_POLICY): $(TARGET_POLICY).elf
|
$(INSTALL_DIR)/$(TARGET_POLICY): $(TARGET_POLICY).elf
|
||||||
$(VERBOSE)$(OBJCOPY) -O binary $< $@
|
$(VERBOSE)$(OBJCOPY) -O binary $< $@
|
||||||
|
@ -2,9 +2,12 @@ PHDRS { rw PT_LOAD; }
|
|||||||
SECTIONS {
|
SECTIONS {
|
||||||
|
|
||||||
.text : {
|
.text : {
|
||||||
*(.data) /* must be first because it contains policy module header */
|
*(.data.rel) /* must be first because it contains policy module header */
|
||||||
|
*(.data)
|
||||||
|
*(.rodata .rodata.*)
|
||||||
*(.text .text.*)
|
*(.text .text.*)
|
||||||
*(.bss)
|
*(.bss)
|
||||||
|
*(.got.plt)
|
||||||
} : rw
|
} : rw
|
||||||
|
|
||||||
/DISCARD/ : { *(.*) }
|
/DISCARD/ : { *(.*) }
|
||||||
|
Loading…
Reference in New Issue
Block a user