Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to build from source (aarch64-freebsd14.0) #681

Closed
bregma opened this issue Dec 13, 2023 · 3 comments
Closed

Fail to build from source (aarch64-freebsd14.0) #681

bregma opened this issue Dec 13, 2023 · 3 comments
Labels
aarch64 Problems specific to the aarch64 ARCH FreeBSD Probelsm specific to the FreeBSD OS
Milestone

Comments

@bregma
Copy link
Member

bregma commented Dec 13, 2023

Code fails to build from source.

$ uname -psr
FreeBSD 14.0-CURRENT aarch64c
$ grep 'host=' config.status
host='aarch64-unknown-freebsd14.0'

First error

--- os-freebsd.lo ---
../../src/os-freebsd.c:144:75: error: expected ';' after expression
       ret = strlen (kv->kve_path) >= pathlen ? -UNW_ENOMEM : UNW_ESUCCESS:;
                                                                          ^
                                                                          ;

Second error

../../src/mi/backtrace.c:72:7: error: no member named 'mc_gpregs' in 'struct __mcontext'
      unw_getcontext (&uc);
      ^~~~~~~~~~~~~~~~~~~~
../include/libunwind-common.h:127:29: note: expanded from macro 'unw_getcontext'
#define unw_getcontext(uc)              unw_tdep_getcontext(uc)
                                        ^~~~~~~~~~~~~~~~~~~~~~~
../../include/libunwind-aarch64.h:251:3: note: expanded from macro 'unw_tdep_getcontext'
  UNW_BASE \
  ^~~~~~~~
../../include/libunwind-aarch64.h:242:95: note: expanded from macro 'UNW_BASE'
# define UNW_BASE register uint64_t unw_base __asm__ ("x0") = (uint64_t) unw_ctx->uc_mcontext.mc_gpregs.gp_x;
                                                                         ~~~~~~~~~~~~~~~~~~~~ ^

Third error

--- aarch64/Los-freebsd.lo ---
In file included from ../../src/aarch64/Los-freebsd.c:4:
In file included from ../../src/aarch64/Gos-freebsd.c:33:
In file included from ../../src/aarch64/unwind_i.h:33:
../../include/libunwind_i.h:240:12: warning: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Wcheri-capability-misuse]
    return (void *)ret;
           ^
In file included from ../../src/aarch64/Los-freebsd.c:4:
In file included from ../../src/aarch64/Gos-freebsd.c:33:
In file included from ../../src/aarch64/unwind_i.h:33:
In file included from ../../include/libunwind_i.h:422:
In file included from ../include/tdep/libunwind_i.h:7:
../../include/tdep-aarch64/libunwind_i.h:138:11: warning: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Wcheri-capability-misuse]
  *val = *(unw_fpreg_t *) DWARF_GET_LOC (loc);
          ^
../../include/tdep-aarch64/libunwind_i.h:147:4: warning: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Wcheri-capability-misuse]
  *(unw_fpreg_t *) DWARF_GET_LOC (loc) = val;
   ^
../../include/tdep-aarch64/libunwind_i.h:156:11: warning: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Wcheri-capability-misuse]
  *val = *(unw_word_t *) DWARF_GET_LOC (loc);
          ^
../../include/tdep-aarch64/libunwind_i.h:165:4: warning: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Wcheri-capability-misuse]
  *(unw_word_t *) DWARF_GET_LOC (loc) = val;
   ^
In file included from ../../src/aarch64/Los-freebsd.c:4:
../../src/aarch64/Gos-freebsd.c:53:24: warning: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Wcheri-capability-misuse]
      ucontext_t *uc = (ucontext_t *)(c->sigcontext_sp + offsetof(struct sigframe, sf_uc));
                       ^
../../src/aarch64/Gos-freebsd.c:56:25: error: no member named 'mc_gpregs' in 'struct __mcontext'
        uc->uc_mcontext.mc_gpregs.gp_x[0] = c->dwarf.eh_args[0];
        ~~~~~~~~~~~~~~~ ^
../../src/aarch64/Gos-freebsd.c:58:25: error: no member named 'mc_gpregs' in 'struct __mcontext'
        uc->uc_mcontext.mc_gpregs.gp_x[1] = c->dwarf.eh_args[1];
        ~~~~~~~~~~~~~~~ ^
../../src/aarch64/Gos-freebsd.c:60:25: error: no member named 'mc_gpregs' in 'struct __mcontext'
        uc->uc_mcontext.mc_gpregs.gp_x[2] = c->dwarf.eh_args[2];
        ~~~~~~~~~~~~~~~ ^
6 warnings and 3 errors generated.

Fourth error

--- aarch64/setcontext.lo ---
../../src/aarch64/setcontext.S:39:15: error: invalid operand for instruction
 ldp x0, x1, [x9, #(0x10 + 0x00)]
              ^
../../src/aarch64/setcontext.S:40:15: error: invalid operand for instruction
 ldp x2, x3, [x9, #(0x10 + 0x00 + 2 * 8)]
              ^
../../src/aarch64/setcontext.S:41:17: error: invalid operand for instruction
 ldp x19, x20, [x9, #(0x10 + 0x00 + 19 * 8)]
                ^
../../src/aarch64/setcontext.S:42:17: error: invalid operand for instruction
 ldp x21, x22, [x9, #(0x10 + 0x00 + 21 * 8)]
                ^
../../src/aarch64/setcontext.S:43:17: error: invalid operand for instruction
 ldp x23, x24, [x9, #(0x10 + 0x00 + 23 * 8)]
                ^
../../src/aarch64/setcontext.S:44:17: error: invalid operand for instruction
 ldp x25, x26, [x9, #(0x10 + 0x00 + 25 * 8)]
                ^
../../src/aarch64/setcontext.S:45:17: error: invalid operand for instruction
 ldp x27, x28, [x9, #(0x10 + 0x00 + 27 * 8)]
                ^
../../src/aarch64/setcontext.S:46:17: error: invalid operand for instruction
 ldp x29, x30, [x9, #(0x10 + 0x00 + 29 * 8)]
                ^
../../src/aarch64/setcontext.S:48:15: error: invalid operand for instruction
 ldp q8, q9, [x9, #(0x10 + 0x110 + 8 * 16)]
              ^
../../src/aarch64/setcontext.S:49:17: error: invalid operand for instruction
 ldp q10, q11, [x9, #(0x10 + 0x110 + 10 * 16)]
                ^
../../src/aarch64/setcontext.S:50:17: error: invalid operand for instruction
 ldp q12, q13, [x9, #(0x10 + 0x110 + 12 * 16)]
                ^
../../src/aarch64/setcontext.S:51:17: error: invalid operand for instruction
 ldp q14, q15, [x9, #(0x10 + 0x110 + 14 * 16)]
                ^

make.log

@bregma bregma added this to the 1.9.0 milestone Dec 13, 2023
@bregma bregma added aarch64 Problems specific to the aarch64 ARCH FreeBSD Probelsm specific to the FreeBSD OS labels Dec 13, 2023
@lemul
Copy link
Contributor

lemul commented Dec 23, 2023

#687 fixes this too

@ararslan
Copy link
Contributor

Is this issue still relevant? I haven't tried FreeBSD 14.0 but I'm able to build current libunwind master on aarch64-unknown-freebsd14.1 without issue. I get a few warnings, but no errors:

  • aarch64/Gstep.c:719:40: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
  • coredump/_UPT_get_dyn_info_list_addr.c:86:3: warning: Implement get_list_addr(), please. [-W#warnings]
  • ./Gtest-nomalloc.c:49:16: warning: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]

Most tests pass as well, except for G/Larm64-test-sve-signal (skipped) and check-namespace.sh (fails).

@bregma
Copy link
Member Author

bregma commented Jun 12, 2024

I do not believe this problem applies any more. Closing.

@bregma bregma closed this as completed Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aarch64 Problems specific to the aarch64 ARCH FreeBSD Probelsm specific to the FreeBSD OS
Projects
None yet
Development

No branches or pull requests

3 participants