bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug libctf/29547] New: binutils-2.39: fails to build against cctools nm


From: slyich at gmail dot com
Subject: [Bug libctf/29547] New: binutils-2.39: fails to build against cctools nm (no '-B' option support)
Date: Sun, 04 Sep 2022 22:36:02 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=29547

            Bug ID: 29547
           Summary: binutils-2.39: fails to build against cctools nm (no
                    '-B' option support)
           Product: binutils
           Version: 2.39
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libctf
          Assignee: unassigned at sourceware dot org
          Reporter: slyich at gmail dot com
  Target Milestone: ---

It's a forward of downstream
https://github.com/NixOS/nixpkgs/pull/185297#issuecomment-1236398635 report by
Robert Scott. There `binutils-2.39` (and I think `binutils-2.38`) fails to
build against Darwin's `cctools` `nm` tool:
https://gist.githubusercontent.com/risicle/dda04fc876a118f494e41a66d26f7eea/raw/2cc35e7f364c8dca6b5166b5140dcd8b1333cea9/gistfile1.txt

Relevant (I think) snpippet:

checking the name lister
(/nix/store/2z3fkfy273yqg2ylxyybvly0dks1nlby-bootstrap-stage0-clang-wrapper-11.1.0/bin/nm
-B) interface... yes

That `nm` is not from llvm, but from
https://opensource.apple.com/source/cctools/, recent example:
https://opensource.apple.com/source/cctools/cctools-973.0.1/misc/nm.c.auto.html

How it fails:

./libtool: eval: line 1115: syntax error near unexpected token `|'
./libtool: eval: line 1115:
`/nix/store/2z3fkfy273yqg2ylxyybvly0dks1nlby-bootstrap-stage0-clang-wrapper-11.1.0/bin/nm
-B  .libs/libctf_nobfd_la-ctf-archive.o .libs/libctf_nobfd_la-ctf-dump.o
.libs/libctf_nobfd_la-ctf-create.o .libs/libctf_nobfd_la-ctf-decl.o
.libs/libctf_nobfd_la-ctf-error.o .libs/libctf_nobfd_la-ctf-hash.o
.libs/libctf_nobfd_la-ctf-labels.o .libs/libctf_nobfd_la-ctf-dedup.o
.libs/libctf_nobfd_la-ctf-link.o .libs/libctf_nobfd_la-ctf-lookup.o
.libs/libctf_nobfd_la-ctf-open.o .libs/libctf_nobfd_la-ctf-serialize.o
.libs/libctf_nobfd_la-ctf-sha1.o .libs/libctf_nobfd_la-ctf-string.o
.libs/libctf_nobfd_la-ctf-subr.o .libs/libctf_nobfd_la-ctf-types.o
.libs/libctf_nobfd_la-ctf-util.o   |  |
/nix/store/8ysd696cpacbvhy61z57w4vg7jn2gncz-bootstrap-stage0-clang/bin/sed
's/.* //' | sort | uniq > .libs/libctf-nobfd.exp'

Why it fails:

NM is detected as NM="nm -B" while this `nm` only supports `nm -p`:

$ nm -B a.o                             a.c
error: nm: invalid argument -B
Usage: nm [-agnopruUmxjlfAP[s segname sectname] [-] [-t format] [[-arch
<arch_flag>] ...] [file ...]

$ nm -p a.o
0000000000000008 D _a
0000000000000000 T _b

$ nm a.o   
0000000000000008 D _a
0000000000000000 T _b

>From what I understand `libtool.m4` marks the option as supported if `nm`
stderr has `nm` output (ignoring the first line):

       # Check to see if the nm accepts a BSD-compat flag.
       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
       #   nm: unknown option "B" ignored
       case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
       *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
         break
         ;;
       *)
         case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'`
in
         *$tmp_nm*)
           lt_cv_path_NM="$tmp_nm -p"
           break
           ;;
         *)
           lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
           continue # so that we can try to find one that supports BSD flags
           ;;
         esac
         ;;
       esac

It does not detect exit status or specific symbols printed from object file.
Very unusual test.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]