Sponsored Content
Top Forums UNIX for Advanced & Expert Users About lib linker(ulibc and glibc) Post 302315144 by otheus on Monday 11th of May 2009 04:17:48 PM
Old 05-11-2009
gcc is just the compiler, not the linker. It will, however, run the linker for you (if you don't specify -c on the command line). There are many linker options. Here's the reference: Link Options - Using the GNU Compiler Collection (GCC)

One way to do it is to specify --nostdlib and then specify all the libraries you do want your program linked to.

If you want more control over gcc's default behavior, I suggest you read the following section:
Spec Files - Using the GNU Compiler Collection (GCC)

Basically, gcc is just a wrapper program which uses rules in a spec file to determine which programs to run and how, including the linker. By changing the spec file, you can control gcc's default behavior when running the linker.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Linker (ld)

hai I have installed Linux 7.0 on my system and i have an doubt the linker i ran simple hello.c program with gcc compiler gcc -c hello.c i want linker to produce the output so i put on the command line as ld first.o -lc but it is not running ver properly but there is an... (1 Reply)
Discussion started by: rajashekaran
1 Replies

2. Programming

Linker error when using vector's

using SUN C++ I have a problem when I do a push_back on a vector. The linker gives me a undefined symbol error on __cxa_end_catch. Any ideas, is there a library to include? Thanks Chris (1 Reply)
Discussion started by: CDurkin
1 Replies

3. UNIX for Advanced & Expert Users

LD linker define symbol

Hi, I want to define a symbol in my code as: extern int Address; and then I'd like to define the symbol value in linker (ld) script file, so each time I change the hardware, I don't need to redefine the value in code, just use different linker script. I've gone through ld reference and didn't... (3 Replies)
Discussion started by: lzwierko
3 Replies

4. Linux

G++ Linker Error

Hi All, I m new to this group. I m facing one problem during my linking of CPP code at Linux env. after compliation i m getting error "undefined reference to ....." Please anyone help me to resolve this error. Regards, ASR make: Leaving directory /fwk' echo g++ -o server ... (1 Reply)
Discussion started by: ASRRAJ
1 Replies

5. HP-UX

Hp-ux linker option -c

Hi, The necessary symbols in a shared library can be exported to the application using linker option --version-script in Linux. The same can be done in Hp-ux using linker option +e. This can also be done by listing all the global symbols with +e in a file with linker option ld -c filename in... (0 Replies)
Discussion started by: roopa_v
0 Replies

6. Programming

GCC: Choose my own linker

Hi, I do not use the default linker, and instead us another one and pass this argument -Wl,--dynamic-linker=<path to linker> to gcc when compiling. However, what happens if the linker is not under /lib and /lib64 and I am not able to create a symlink to the linker in /lib or /lib64 due to no... (2 Replies)
Discussion started by: Shompis
2 Replies

7. Red Hat

ls: /lib/libattr.so.1: no version information available (required by /lib/libacl.so.1)

Hello, I'm experimenting a problem on my rh server. Red Hat Enterprise Linux AS release 3 (Taroon Update 8) 2.4.21-47.ELsmp #1 SMP i686 i686 i386 GNU/Linux It started with a segmentation fault on #id root To resolve it, I've installed coreutils-4.5.3-28.4.i386.rpm But, I... (6 Replies)
Discussion started by: gogol_bordello
6 Replies

8. Programming

AIX linker oddities...what is going on?

I've tried to figure out what the linker is smoking in AIX to no avail...so I'm trying to find a little information to see why it's being inconsistent. I have the following code in a shared library, it doesn't do anything useful, it's just there to exercise functions in a few system libraries: ... (11 Replies)
Discussion started by: DreamWarrior
11 Replies

9. Solaris

runtime linker errors

Hey guys I have a solaris 10 OS, with a zone configured. In that zone, I am trying to install an Oracle Client. However, when I run the oracle installer, I get the following error: ld.so.1: java: fatal: libexpat.so.0: open failed: No such file or directory ld.so.1: java: fatal:... (2 Replies)
Discussion started by: goodvikings
2 Replies

10. UNIX and Linux Applications

Install glibc-debug for glibc-2.11.3-17.31.1 on SLES 11

I have to debug a function getopt_long in glibc-2.11.3-17.31.1. For that how can I download and install its corresponding glibc-debug on SLES 11? (8 Replies)
Discussion started by: rupeshkp728
8 Replies
LD.HUGETLBFS(1) 					      General Commands Manual						   LD.HUGETLBFS(1)

NAME
ld.hugetlbfs - link a program for huge pages SYNOPSIS
ld.hugetlbfs [options] DESCRIPTION
ld.hugetlbfs replaces the normal ld command for linking programs to use hugepages. Under gcc, you should use the option -B /usr/share/lib- hugetlbfs which tells gcc to look in a non-standard location for the linker. This could be set in the CFLAGS environment variable. -Wl,--hugetlbfs-align This method of linking an application permits greater flexibility at runtime. Using HUGETLB_ELFMAP, it is possible to control which program segments are placed in hugepages. The following four settings will cause the indicated segments to be placed in hugepages: HUGETLB_ELFMAP=R Read-only segments (text) HUGETLB_ELFMAP=W Writable segments (data/BSS) HUGETLB_ELFMAP=RW All segments (text/data/BSS) HUGETLB_ELFMAP=no No segments It is possible to select specific huge page sizes for read-only and writable segments by using the following advanced syntax: HUGETLB_ELFMAP=[R[=<pagesize>]:[W[=<pagesize>]] -Wl,--hugetlbfs-link=B Under binutils 2.16 or older, this option will link the application to store BSS data (only) into hugepages. -Wl,--hugetlbfs-link=BDT Under binutils 2.16 or older, this option will link the application to store text, initialized data and BSS data into hugepages. FILES
[DESTDIR|/usr/share]/doc/libhugetlbfs/HOWTO SEE ALSO
libhugetlbfs(7), hugectl(8), hugeedit(8) AUTHORS
libhugetlbfs was written by various people on the libhugetlbfs-devel mailing list. March 12, 2012 LD.HUGETLBFS(1)
All times are GMT -4. The time now is 03:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy