Date: Wed, 4 Jan 2017 22:07:46 +0300 From: Alexander Tarasikov <alexander.tarasikov@gmail.com> To: Derrick McKee <derrick.mckee@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Using non-standard libc Message-ID: <CAMChaFxKmLjqUb=SJjZxFTjOfE6=Hm15Cnk68q3J1kVcryALqA@mail.gmail.com> In-Reply-To: <CAJoBWHyG8mugoJWKzqyJYHd6faHuWA1FFYimhJ-tLf-gLLwuZg@mail.gmail.com> References: <CAJoBWHxmgo00FjRftxE5RpCe3%2B1jgr%2BiU_m2rufBAz9yWab7nw@mail.gmail.com> <CAJoBWHyG8mugoJWKzqyJYHd6faHuWA1FFYimhJ-tLf-gLLwuZg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
I think you need to grep for the "environ" symbol. Most likely it's in the crt library (crt1.o or crti.o). On Linux that would be libgcc (lgcc) which provides crtbegin.o, should be something similar on FreeBSD. On Wed, Jan 4, 2017 at 9:05 PM, Derrick McKee <derrick.mckee@gmail.com> wrote: > Hi, > > I am conducting research into memory safety, and I have developed a custom > LLVM pass. I have successfully built libc using my pass. However, when I > try to compile a helloworld program using my built libc, I get a whole > bunch of undefined reference errors: > > /path/to/custom/clang -static -nostdlib -L/usr/src/lib/libc -lc > -I/usr/src/include hello.c > > /usr/bin/ld: warning: cannot find entry symbol _start; defaulting to > 0000000000400160 > /usr/src/lib/libc/libc.a(getenv.o): In function `__clean_env': > /usr/src/lib/libc/stdlib/getenv.c:(.text+0x168): undefined reference to > `environ' > /usr/src/lib/libc/stdlib/getenv.c:(.text+0x171): undefined reference to > `environ' > /usr/src/lib/libc/libc.a(getenv.o): In function `getenv': > /usr/src/lib/libc/stdlib/getenv.c:(.text+0x1f6): undefined reference to > `environ' > /usr/src/lib/libc/libc.a(getenv.o): In function `__merge_environ': > /usr/src/lib/libc/stdlib/getenv.c:(.text+0x42d): undefined reference to > `environ' > /usr/src/lib/libc/stdlib/getenv.c:(.text+0x459): undefined reference to > `environ' > /usr/src/lib/libc/libc.a(getenv.o):/usr/src/lib/libc/stdlib/getenv.c:(.text+0x524): > more undefined references to `environ' follow > /usr/src/lib/libc/libc.a(getprogname.o): In function `getprogname': > /usr/src/lib/libc/gen/getprogname.c:(.text+0x7): undefined reference to > `__progname' > /usr/src/lib/libc/libc.a(auxv.o): In function `init_aux_vector_once': > /usr/src/lib/libc/gen/auxv.c:(.text+0x27): undefined reference to `environ' > /usr/src/lib/libc/libc.a(exec.o): In function `execl': > /usr/src/lib/libc/gen/exec.c:(.text+0x154): undefined reference to `environ' > /usr/src/lib/libc/libc.a(exec.o): In function `execlp': > /usr/src/lib/libc/gen/exec.c:(.text+0x484): undefined reference to `environ' > /usr/src/lib/libc/libc.a(exec.o): In function `execvp': > /usr/src/lib/libc/gen/exec.c:(.text+0x4e3): undefined reference to `environ' > /usr/src/lib/libc/libc.a(exec.o): In function `execv': > /usr/src/lib/libc/gen/exec.c:(.text+0x537): undefined reference to `environ' > /usr/src/lib/libc/libc.a(exec.o):/usr/src/lib/libc/gen/exec.c:(.text+0x5b7): > more undefined references to `environ' follow > clang-4.0: error: linker command failed with exit code 1 (use -v to see > invocation) > > Any idea of what I am missing? Thanks. > -- > Derrick McKee > Ph.D. Student at Purdue University > -- > Derrick McKee > Ph.D. Student at Purdue University > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" -- Regards, Alexander
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMChaFxKmLjqUb=SJjZxFTjOfE6=Hm15Cnk68q3J1kVcryALqA>