Add to linker command line linux

4.4. Simple Linker Script Commands

In this section we describe the simple linker script commands.

4.4.1. Setting the Entry Point

The first instruction to execute in a program is called the entry point . You can use the ENTRY linker script command to set the entry point. The argument is a symbol name:

There are several ways to set the entry point. The linker will set the entry point by trying each of the following methods in order, and stopping when one of them succeeds:

the -e entry command-line option;

the ENTRY( symbol ) command in a linker script;

the value of the symbol start , if defined;

the address of the first byte of the .text section, if present;

4.4.2. Commands Dealing with Files

Several linker script commands deal with files.

Include the linker script filename at this point. The file will be searched for in the current directory, and in any directory specified with the -L option. You can nest calls to INCLUDE up to 10 levels deep.

INPUT( file , file , …) , INPUT( file file …)

The INPUT command directs the linker to include the named files in the link, as though they were named on the command line.

For example, if you always want to include subr.o any time you do a link, but you can’t be bothered to put it on every link command line, then you can put INPUT (subr.o) in your linker script.

In fact, if you like, you can list all of your input files in the linker script, and then invoke the linker with nothing but a -T option.

In case a sysroot prefix is configured, and the filename starts with the / character, and the script being processed was located inside the sysroot prefix , the filename will be looked for in the sysroot prefix . Otherwise, the linker will try to open the file in the current directory. If it is not found, the linker will search through the archive library search path. See the description of -L in Section 3.1 Command Line Options .

If you use INPUT (-l file ) , ld will transform the name to lib file .a , as with the command line argument -l .

When you use the INPUT command in an implicit linker script, the files will be included in the link at the point at which the linker script file is included. This can affect archive searching.

GROUP( file , file , …) , GROUP( file file …)

The GROUP command is like INPUT , except that the named files should all be archives, and they are searched repeatedly until no new undefined references are created. See the description of -( in Section 3.1 Command Line Options .

Читайте также:  Linux service status exit code

The OUTPUT command names the output file. Using OUTPUT( filename ) in the linker script is exactly like using -o filename on the command line (refer to Section 3.1 Command Line Options ). If both are used, the command line option takes precedence.

You can use the OUTPUT command to define a default name for the output file other than the usual default of a.out .

The SEARCH_DIR command adds path to the list of paths where ld looks for archive libraries. Using SEARCH_DIR( path ) is exactly like using -L path on the command line (refer to Section 3.1 Command Line Options ). If both are used, then the linker will search both paths. Paths specified using the command line option are searched first.

The STARTUP command is just like the INPUT command, except that filename will become the first input file to be linked, as though it were specified first on the command line. This may be useful when using a system in which the entry point is always the start of the first file.

4.4.3. Commands Dealing with Object File Formats

A couple of linker script commands deal with object file formats.

The OUTPUT_FORMAT command names the BFD format to use for the output file (refer to Chapter 6 BFD ). Using OUTPUT_FORMAT( bfdname ) is exactly like using -oformat bfdname on the command line (refer to Section 3.1 Command Line Options ). If both are used, the command line option takes precedence.

You can use OUTPUT_FORMAT with three arguments to use different formats based on the -EB and -EL command line options. This permits the linker script to set the output format based on the desired endianness.

If neither -EB nor -EL are used, then the output format will be the first argument, default . If -EB is used, the output format will be the second argument, big . If -EL is used, the output format will be the third argument, little .

For example, the default linker script for the MIPS ELF target uses this command:

UTPUT_FORMAT(elf32-bigmips, elf32-bigmips, elf32-littlemips)

This says that the default format for the output file is elf32-bigmips , but if the user uses the -EL command line option, the output file will be created in the elf32-littlemips format.

The TARGET command names the BFD format to use when reading input files. It affects subsequent INPUT and GROUP commands. This command is like using -b bfdname on the command line (refer to Section 3.1 Command Line Options ). If the TARGET command is used but OUTPUT_FORMAT is not, then the last TARGET command is also used to set the format for the output file. Refer to Chapter 6 BFD .

4.4.4. Other Linker Script Commands

There are a few other linker scripts commands.

Ensure that exp is non-zero. If it is zero, then exit the linker with an error code, and print message .

Force symbol to be entered in the output file as an undefined symbol. Doing this may, for example, trigger linking of additional modules from standard libraries. You may list several symbol s for each EXTERN , and you may use EXTERN multiple times. This command has the same effect as the -u command-line option.

Читайте также:  What is syslog daemon in linux

This command has the same effect as the -d command-line option: to make ld assign space to common symbols even if a relocatable output file is specified ( -r ).

This command has the same effect as the -no-define-common command-line option: to make ld omit the assignment of addresses to common symbols even for a non-relocatable output file.

NOCROSSREFS( section section …)

This command may be used to tell ld to issue an error about any references among certain output sections.

In certain types of programs, particularly on embedded systems when using overlays, when one section is loaded into memory, another section will not be. Any direct references between the two sections would be errors. For example, it would be an error if code in one section called a function defined in the other section.

The NOCROSSREFS command takes a list of output section names. If ld detects any cross references between the sections, it reports an error and returns a non-zero exit status. Note that the NOCROSSREFS command uses output section names, not input section names.

Specify a particular output machine architecture. The argument is one of the names used by the BFD library (refer to Chapter 6 BFD ). You can see the architecture of an object file by using the objdump program with the -f option.

Источник

Ubuntu – How to add a directory to linker command line in linux

gksudo firefox -install-global-extension addon-1865-latest.xpi seems to do the trick for you. That will install the extension to all users on your system.

To install the extension only for your user use the extension path as an argument

firefox addon-1865-latest.xpi 

You still need to click the Install button though!

Automating the installation

Firefox does not need the addon file name but the identifier from the addon as a package name. That means that if you are planning on installing an addon without user intervention you need to extract it to a folder with the name of the addon identifier string, not the name of the addon.

The identifier string can be found on the first lines of the addon install manifest file install.rdf and it looks like this: . Everything within the <> (including the curly braces) is the identifier.

To get an addon to work you need to extract the package, rename the folder that contains the files to the addon identifier string and place it either on the global addon folder or within the user addon folder.

Global addon install

If you want to install an extension automatically to all users in your system you need to extract it, rename the folder that contains the addon to the addon’s id string and copy it to the firefox global extensions folder /usr/share/mozilla/extensions// , anything that you use there will be called up automatic when a user opens firefox .

User specific install

If you want to install an extension automatically to just one user in your system you need to extract it, rename the folder that contains the addon to the addon’s id string and copy it to the firefox user extensions folder /home/user_name/.mozilla/extensions// (create it if it does not exist), anything that you use there will be called up automatic when a user opens firefox .

Читайте также:  Linux chmod for directories

How-to prepare an addon for automatic install — Example

Make an extensions folder in your home and download the addon in to it

mkdir ~/extensions cd ~/extensions wget https://addons.mozilla.org/firefox/downloads/latest/1865/addon-1865-latest.xpi 

Extract it and delete the original

unzip ~/extensions/addon-1865-latest.xpi rm ~/extensions/addon-1865-latest.xpi 

Read the first line in the install.rdf file to get the addon’s id (in this case it will be ). and create a folder with that name

Move all the files in your extensions folder into the newly created ~/extensions/ and you are ready to install by moving the folder, as described, for a local install or for a global install.

How-to set the default home page

To change your homepage without using the preferences inside firefox you have to edit ~/.mozilla/firefox/*.default/prefs.js (where *.default is a folder inside ~/.mozilla/firefox created for your user) and add this line to the end of it

user_pref("browser.startup.homepage", "http://uptechtalk.com"); 
echo "user_pref("browser.startup.homepage", "http://uptechtalk.com");" >> ~/.mozilla/firefox/*.default/prefs.js 

You need to do it after closing firefox or the program will overwrite the setting on exit.

If your user has not used firefox yet and you want to set the homepage for all new users (set homepage globally) use this command

echo "user_pref("browser.startup.homepage", "http://uptechtalk.com");" >> /etc/xul-ext/ubufox.js 

Comments about your question

-silent does not exist, you will be prompted to install that xpi extension anyways and you have to click the button to install it;

-setDefaultBrowser will not set your homepage, it will make firefox your default browser

Ubuntu – Mounting OneDrive on Ubuntu Linux command line

Mount OneDrive on Ubuntu

1. Download and install Rclone

or download the latest one

wget https://downloads.rclone.org/v1.42/rclone-v1.42-linux-amd64.deb sudo apt install ./rclone-v1.42-linux-amd64.deb 

2. Add a new OneDrive remote to Rclone

$ rclone config Current remotes: Name Type ==== ==== mega mega e) Edit existing remote n) New remote d) Delete remote r) Rename remote c) Copy remote s) Set configuration password q) Quit config e/n/d/r/c/s/q> n 
Type of storage to configure. Choose a number from below, or type in your own value [snip] . . xx / Microsoft OneDrive \ "onedrive" . . [snip] Storage> onedrive 
Microsoft App Client Id Leave blank normally. client_id> Microsoft App Client Secret - leave blank normally. client_secret> 
Remote config Choose OneDrive account type? * Say b for a OneDrive business account * Say p for a personal OneDrive account b) Business p) Personal b/p> p 
Use auto config? * Say Y if not sure * Say N if you are working on a remote or headless machine y) Yes n) No y/n> y 
[onedrive] type = onedrive client_id = client_secret = token = -------------------- y) Yes this is OK e) Edit this remote d) Delete this remote y/e/d> y 
Current remotes: Name Type ==== ==== onedrive onedrive e) Edit existing remote n) New remote d) Delete remote r) Rename remote c) Copy remote s) Set configuration password q) Quit config e/n/d/r/c/s/q> q 

3. Create a new folder

4. Mount OneDrive

rclone --vfs-cache-mode writes mount onedrive: ~/OneDrive 

You can stop and unmount it by pressing Ctrl + c to close Rclone.

5. (Optional) Mount OneDrive on system startup

To mount OneDrive on startup, open Startup Applications, and in Startup Applications click Add.

After clicking Add, use the following:

Name: Rclone OneDrive Mount Command: sh -c "rclone --vfs-cache-mode writes mount onedrive: ~/OneDrive" 

There are other ways of mounting OneDrive automatically, like adding a line in your /etc/fstab file , using systemd, etc.

Related Question

Источник

Оцените статью
Adblock
detector