<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59369>59369</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Linker undefined reference to pow
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          CaseyAllen
      </td>
    </tr>
</table>

<pre>
    Im writing a frontend for llvm and found an issue with the `llvm.pow.f64` declaration which is generated by the `getDeclaration` method, the linker will complain about an `undefined reference`.
If the symbol is renamed to `llvm.pow.f64.f64` manually, it will work.
Ive seen a similar issue on here, but im not sure if this is related, so if this is relevant im on an AMD x86-64 Linux (Arch) System.

Here is the ir which generates the error:
```llvm
; ModuleID = 'Quinoa Program'
source_filename = "Quinoa Program"
target triple = "x86_64-pc-linux-gnu"

define i32 @main() {
entry_block:
  %0 = call double @llvm.pow.f64(double 0x3FD5555555555555, double 0x3FD5555555555555)
  %1 = fptosi double %0 to i32
  ret i32 %1
}

; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare double @llvm.pow.f64(double, double) #0

attributes #0 = { nofree nosync nounwind readnone speculatable willreturn }
```

and here is the clang output:
``` 
clang version 14.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/12.2.0
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/usr/bin/clang-14" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name tmp_ir.ll -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/casey/quinoa -resource-dir /usr/lib/clang/14.0.6 -fdebug-compilation-dir=/home/casey/quinoa -ferror-limit 19 -stack-protector 2 -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/tmp_ir-0ee4d9.o -x ir tmp/tmp_ir.ll
clang -cc1 version 14.0.6 based upon LLVM 14.0.6 default target x86_64-pc-linux-gnu
 "/usr/bin/ld" -pie --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib64/Scrt1.o /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib64/crti.o /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/crtbeginS.o -L/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0 -L/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/lib -L/usr/lib /tmp/tmp_ir-0ee4d9.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/crtendS.o /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib64/crtn.o
/usr/bin/ld: /tmp/tmp_ir-0ee4d9.o: in function `main':
Quinoa Program:(.text+0xd): undefined reference to `pow'
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8V91u47gVfhrm5oCCRDlyfOELJ653B8gAbV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