Hi,

I realize my issues are far from the current mostly-Sculpt roadmap, but perhaps someone can throw some light on my problems...at least I'm dealing with current hardware devoid of parallel ports :o

I've been carefully creating a build structure in base-hw that will support armv8 and at least AArch64 over the past several months. I'm at the point where I have made all the architectural additions to support armv8 and the arm64  assembler which includes support for the assembler instruction changes from armv7, execution modes, and exception levels (only EL0 and EL1, initially). Everything builds for a cortex A-53 platform but fails in the final linking steps in two ways as described below. But first, my build tools are a copy of the Linaro toolchain, version 6.4.1, which used binutils 2.27, and my CROSS_DEV_PREFIX points to its location. I'm building in Genode 18.02

1. The final linking step fails initially with the "_impure_ptr" global not being resolved (see the build output in build_impure.log). Typically this global is supplied via libc, but Genode's special libc does not contain it. This global is a pointer to a structure that contains "errno" from failed C-code execution, along with some concurrency data for threading, if remember correctly. The pointer is only used in vterminate.cc which comes from the toolchain. In the currently used Genode toolchain the library supc++.o contains vterminate.o which is stripped, so the linker would not complain about the pointer. Is this by design because the process is about to die anyway when vterminate is called? To temporarily work around this problem I created a dummy  void * _impure_ptr global in base/lib/cxx/misc.cc. The linker now continues and eventually completes.

2. The second problem is the size of the executable image files that the linker produces, several gigabytes! The actual memory image of the executable appears correct based on a dump of the section header but the header information shows that the File Offsets to the sections appears to be based off the link address. For example, in the creation of the boot image, build_core creates the binary log.bootstrap, the dump of which is:

objdump -h ../build/dragonboard/var/run/log.bootstrap |more

../build/dragonboard/var/run/log.bootstrap:     file format elf64-little

Sections:
Idx Name          Size      VMA               LMA File off  Algn
  0 .note.gnu.build-id 00000024  0000000000000000 0000000000000000  81042000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .text         0003b840  0000000081000000  0000000081000000 81001000  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .data         00000718  000000008103c000  000000008103c000 8103d000  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  3 .got          000000e0  000000008103c718  000000008103c718 8103d718  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  4 .got.plt      00000018  000000008103c7f8  000000008103c7f8 8103d7f8  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  5 .eh_frame     00003084  000000008103c810  000000008103c810 8103d810  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .gcc_except_table 00000968  000000008103f894 000000008103f894 81040894  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .bss          00008f09  0000000081040200  0000000081040200 810411fc  2**3
                  ALLOC

It would appear that all the "File off" values are the expected value plus the bootstrap_link_address which is 0x81000000. Additionally, there is no stack unwind sections present, that is .ARM.exid/extab.

The linker script being used is base/src/ld/genode.ld, as it should be.

I don't have sufficient knowledge about linker functioning to begin to understand how the File offset values are determined or how the c++ stack unwind section is added, or not. Any suggestions would be very helpful.

Thanks,

    Bob Stewart

including /Work/Genode/genode-18.02/tool/run/boot_dir/hw
including /Work/Genode/genode-18.02/repos/base/run/log.run
building targets: core init test/log
spawn make core init test/log
make[1]: Entering directory '/Work/Genode/genode-18.02/build/dragonboard'
checking library dependencies...
  Library syscall-hw
    COMPILE  kernel/interface.o
    MERGE    syscall-hw.lib.a
  Library base-hw-common
    COMPILE  allocator_avl.o
    COMPILE  avl_tree.o
    COMPILE  child.o
    COMPILE  child_process.o
    COMPILE  component.o
    COMPILE  console.o
    COMPILE  elf_binary.o
    COMPILE  entrypoint.o
    COMPILE  env_session_id_space.o
    COMPILE  heap.o
    COMPILE  ipc.o
    COMPILE  lock.o
    COMPILE  log.o
    COMPILE  output.o
    COMPILE  raw_output.o
    COMPILE  region_map_client.o
    COMPILE  registry.o
    COMPILE  rm_session_client.o
    COMPILE  root_proxy.o
    COMPILE  rpc_dispatch_loop.o
    COMPILE  rpc_entrypoint.o
    COMPILE  session_state.o
    COMPILE  signal_common.o
    COMPILE  signal_transmitter.o
    COMPILE  slab.o
    COMPILE  sleep.o
    COMPILE  sliced_heap.o
    COMPILE  stack_allocator.o
    COMPILE  thread.o
    COMPILE  thread_bootstrap.o
    COMPILE  thread_myself.o
    COMPILE  trace.o
    MERGE    base-hw-common.lib.a
  Library cxx
    COMPILE  exception.o
    COMPILE  guard.o
    COMPILE  malloc_free.o
    COMPILE  misc.o
    COMPILE  new_delete.o
    MERGE    supc++.o
    CONVERT  supc++.o
    COMPILE  unwind.o
    MERGE    cxx.lib.a
  Library core-hw
    COMPILE  _main.o
    COMPILE  capability.o
    COMPILE  core_log.o
    COMPILE  core_log_out.o
    COMPILE  core_mem_alloc.o
    COMPILE  core_region_map.o
    COMPILE  core_rpc_cap_alloc.o
    COMPILE  cpu_session_component.o
    COMPILE  cpu_session_support.o
    COMPILE  cpu_thread_component.o
    COMPILE  dataspace_component.o
    COMPILE  default_log.o
    COMPILE  dump_alloc.o
    COMPILE  env.o
    COMPILE  init_main_thread.o
    COMPILE  io_mem_session_component.o
    COMPILE  io_mem_session_support.o
    COMPILE  irq_session_component.o
    COMPILE  kernel/cpu.o
    COMPILE  kernel/cpu_scheduler.o
    COMPILE  kernel/double_list.o
    COMPILE  kernel/init.o
    COMPILE  kernel/ipc_node.o
    COMPILE  kernel/irq.o
    COMPILE  kernel/object.o
    COMPILE  kernel/signal_receiver.o
    COMPILE  kernel/thread.o
    COMPILE  kernel/timer.o
    COMPILE  kernel_log.o
    COMPILE  main.o
    COMPILE  native_pd_component.o
    COMPILE  native_utcb.o
    COMPILE  pager.o
    COMPILE  pd_session_component.o
    COMPILE  pd_session_support.o
    COMPILE  platform.o
    COMPILE  platform_pd.o
    COMPILE  platform_rom_modules.o
    COMPILE  platform_thread.o
    COMPILE  ram_dataspace_factory.o
    COMPILE  ram_dataspace_support.o
    COMPILE  region_map_component.o
    COMPILE  region_map_support.o
    COMPILE  rom_session_component.o
    COMPILE  signal_receiver.o
    COMPILE  signal_transmitter_noinit.o
    COMPILE  spec/64bit/memory_map.o
    COMPILE  spec/arm64/cpu.o
    ASSEMBLE spec/arm64/crt0.o
    ASSEMBLE spec/arm64/exception_vector.o
    COMPILE  spec/arm64/kernel/thread.o
/Work/Genode/genode-18.02/repos/base/../base-hw/src/core/spec/arm64/kernel/thread.cc: In member function ‘virtual void Kernel::Thread::exception(Kernel::Cpu&)’:
/Work/Genode/genode-18.02/repos/base/../base-hw/src/core/spec/arm64/kernel/thread.cc:25:14: warning: variable ‘e_origin’ set but not used [-Wunused-but-set-variable]
  int e_type, e_origin;
              ^~~~~~~~
In file included from /Work/Genode/genode-18.02/repos/base/../base-hw/src/core/spec/cortex_a53/cpu.h:20:0,
                 from /Work/Genode/genode-18.02/repos/base/../base-hw/src/core/kernel/thread.h:18,
                 from /Work/Genode/genode-18.02/repos/base/../base-hw/src/core/kernel/cpu.h:21,
                 from /Work/Genode/genode-18.02/repos/base/../base-hw/src/core/spec/arm64/kernel/thread.cc:15:
/Work/Genode/genode-18.02/repos/base/../base-hw/src/core/spec/arm64/fpu.h: In static member function ‘static Genode::Register<32ul>::access_t Genode::Fpu::Fpexc::read()’:
/Work/Genode/genode-18.02/repos/base/../base-hw/src/core/spec/arm64/fpu.h:72:12: warning: ‘v’ is used uninitialized in this function [-Wuninitialized]
     return v;
            ^
    COMPILE  spec/arm64/platform_support.o
    COMPILE  spec/arm64/smp/kernel/cpu.o
    COMPILE  spec/arm64/smp/kernel/thread_update_pd.o
    COMPILE  spec/arm_gic/pic.o
    COMPILE  spec/arm_v8/cpu.o
    COMPILE  spec/arm_v8/perf_counter.o
    COMPILE  spec/cortex_a53/fpu.o
In file included from /Work/Genode/genode-18.02/repos/base/../base-hw/src/core/spec/cortex_a53/cpu.h:20:0,
                 from /Work/Genode/genode-18.02/repos/base/../base-hw/src/core/spec/cortex_a53/fpu.cc:16:
/Work/Genode/genode-18.02/repos/base/../base-hw/src/core/spec/arm64/fpu.h: In static member function ‘static Genode::Register<32ul>::access_t Genode::Fpu::Fpexc::read()’:
/Work/Genode/genode-18.02/repos/base/../base-hw/src/core/spec/arm64/fpu.h:72:12: warning: ‘v’ is used uninitialized in this function [-Wuninitialized]
     return v;
            ^
    COMPILE  spec/cortex_a53/kernel/cpu.o
    COMPILE  spec/cortex_a53/timer.o
    COMPILE  spec/dragonboard/platform_services.o
    COMPILE  spec/dragonboard/platform_support.o
    COMPILE  spec/smp/kernel/cpu.o
    COMPILE  spec/smp/kernel/kernel.o
    COMPILE  stack_area.o
    COMPILE  stack_area_addr.o
    COMPILE  thread_start.o
    COMPILE  trace_session_component.o
    COMPILE  version.o
    MERGE    core-hw.lib.a
  Program core/hw/core
  Library ldso-startup
    COMPILE  startup.o
    COMPILE  unwind_exidx.o
    MERGE    ldso-startup.lib.a
  Library ld
    CONVERT  ld.symbols.s
    ASSEMBLE ld.symbols.o
    MERGE    ld.abi.so
  Library base
    MERGE    base.lib.a
  Program init/init
    COMPILE  child.o
    COMPILE  main.o
    COMPILE  server.o
    LINK     init
  Program test/log/test-log
    COMPILE  main.o
    LINK     test-log
make[1]: Leaving directory '/Work/Genode/genode-18.02/build/dragonboard'
genode build completed
checking configuration syntax
  CHECK init
building targets: bootstrap/hw core/hw lib/ld/hw
spawn make bootstrap/hw core/hw lib/ld/hw
make[1]: Entering directory '/Work/Genode/genode-18.02/build/dragonboard'
checking library dependencies...
  Library cxx
  Library bootstrap-hw
    COMPILE  bootstrap/env.o
    COMPILE  bootstrap/init.o
    COMPILE  bootstrap/lock.o
    COMPILE  bootstrap/log.o
    COMPILE  bootstrap/platform.o
    COMPILE  bootstrap/spec/arm64/cortex_a53_mmu.o
    COMPILE  bootstrap/spec/arm64/cpu.o
    ASSEMBLE bootstrap/spec/arm64/crt0.o
    COMPILE  bootstrap/spec/arm64/pic.o
    COMPILE  bootstrap/spec/dragonboard/platform.o
    COMPILE  bootstrap/thread.o
    COMPILE  hw/capability.o
    COMPILE  hw/spec/64bit/memory_map.o
    COMPILE  hw/spec/arm64/arm_v8_cpu.o
    COMPILE  lib/base/allocator_avl.o
    COMPILE  lib/base/avl_tree.o
    COMPILE  lib/base/console.o
    COMPILE  lib/base/elf_binary.o
    COMPILE  lib/base/heap.o
    COMPILE  lib/base/log.o
    COMPILE  lib/base/output.o
    COMPILE  lib/base/registry.o
    COMPILE  lib/base/slab.o
    COMPILE  lib/base/sleep.o
    COMPILE  lib/base/sliced_heap.o
    COMPILE  lib/startup/_main.o
    MERGE    bootstrap-hw.lib.a
  Program bootstrap/hw/bootstrap
  Library syscall-hw
  Library base-hw-common
  Library core-hw
    COMPILE  version.o
    MERGE    core-hw.lib.a
  Program core/hw/core
  Library alarm
    COMPILE  alarm.o
    MERGE    alarm.lib.a
  Library timed_semaphore
    COMPILE  timed_semaphore.o
    MERGE    timed_semaphore.lib.a
  Library startup-hw
    COMPILE  _main.o
    ASSEMBLE crt0.o
    COMPILE  init_main_thread.o
    MERGE    startup-hw.lib.a
  Library timeout-hw
    COMPILE  duration.o
    COMPILE  hw/timer_connection_timestamp.o
    COMPILE  timeout.o
    COMPILE  timer_connection.o
    COMPILE  timer_connection_time.o
    MERGE    timeout-hw.lib.a
  Library base-hw
    COMPILE  cache.o
    COMPILE  capability.o
    COMPILE  default_log.o
    COMPILE  env_deprecated.o
    COMPILE  env_reinit.o
    COMPILE  log_console.o
    COMPILE  main_thread_cap.o
    COMPILE  native_utcb.o
    COMPILE  raw_write_string.o
    COMPILE  rpc_cap_alloc.o
    COMPILE  signal_receiver.o
    COMPILE  stack_area.o
    COMPILE  stack_area_addr.o
    COMPILE  thread_start.o
    MERGE    base-hw.lib.a
  Library ldso-startup
  Library ld-hw
    COMPILE  debug.o
    COMPILE  dependency.o
    COMPILE  exception.o
    ASSEMBLE jmp_slot.o
    COMPILE  main.o
    COMPILE  shared_object.o
    COMPILE  test.o
    CONVERT  symbol.map
    MERGE    ld-hw.lib.so
/NFS/usr/local/bin/linaro_6.4.1/bin/aarch64-elf-ld: /Work/Genode/genode-18.02/build/dragonboard/var/libcache/cxx/cxx.lib.a(supc++.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `_impure_ptr' can not be used when making a shared object; recompile with -fPIC
/NFS/usr/local/bin/linaro_6.4.1/bin/aarch64-elf-ld: /Work/Genode/genode-18.02/build/dragonboard/var/libcache/cxx/cxx.lib.a(supc++.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `_impure_ptr' can not be used when making a shared object; recompile with -fPIC
/NFS/usr/local/bin/linaro_6.4.1/bin/aarch64-elf-ld: /Work/Genode/genode-18.02/build/dragonboard/var/libcache/cxx/cxx.lib.a(supc++.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `_impure_ptr' can not be used when making a shared object; recompile with -fPIC
    CONVERT  ld-hw.symbols.s
    ASSEMBLE ld-hw.symbols.o
    MERGE    ld-hw.abi.so
  Program lib/ld/hw/ld-hw
make[1]: Leaving directory '/Work/Genode/genode-18.02/build/dragonboard'
genode build completed
using 'ld-hw.lib.so' as 'ld.lib.so'
core link address is 0x85000000
debug/core-hw.o: In function `__gnu_cxx::__verbose_terminate_handler()':
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-elf/snapshots/gcc.git~linaro-6.4-2018.05/libstdc++-v3/libsupc++/vterminate.cc:67: undefined reference to `_impure_ptr'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-elf/snapshots/gcc.git~linaro-6.4-2018.05/libstdc++-v3/libsupc++/vterminate.cc:67: undefined reference to `_impure_ptr'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-elf/snapshots/gcc.git~linaro-6.4-2018.05/libstdc++-v3/libsupc++/vterminate.cc:69: undefined reference to `_impure_ptr'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-elf/snapshots/gcc.git~linaro-6.4-2018.05/libstdc++-v3/libsupc++/vterminate.cc:72: undefined reference to `_impure_ptr'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-elf/snapshots/gcc.git~linaro-6.4-2018.05/libstdc++-v3/libsupc++/vterminate.cc:49: undefined reference to `_impure_ptr'
debug/core-hw.o:/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-elf/snapshots/gcc.git~linaro-6.4-2018.05/libstdc++-v3/libsupc++/vterminate.cc:49: more undefined references to `_impure_ptr' follow
collect2: error: ld returned 1 exit status
    while executing
"exec [cross_dev_prefix]g++ {*}$arch -nostdlib {*}[core_ld_opts]  -Wl,-z -Wl,max-page-size=0x1000  -Wl,-Ttext=$link_address -Wl,-gc-sections  -Wl,-nost..."
    (procedure "build_core" line 18)
    invoked from within
"build_core debug/$core_obj                 {} [run_dir].core      [core_link_address]"
    (procedure "run_boot_dir" line 43)
    invoked from within
"run_boot_dir $binaries"
    (procedure "build_boot_image" line 27)
    invoked from within
"build_boot_image "core ld.lib.so init test-log""
    (file "/Work/Genode/genode-18.02/repos/base/run/log.run" line 23)
    invoked from within
"source $include_name"
    ("foreach" body line 6)
    invoked from within
"foreach include_name [get_cmd_arg --include ""] {
	# first check if the include name is absolute
	if {[string first "/" $include_name] == 0} {
		puts ..."
    (file "/Work/Genode/genode-18.02/tool/run/run" line 959)
make: *** [run/log] Error 1

Makefile:312: recipe for target 'run/log' failed
_______________________________________________
Genode users mailing list
[email protected]
https://lists.genode.org/listinfo/users

Reply via email to