Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

0 votes
1 answers
92 views
GNU assembler alternatives
I am trying to build my system from scratch, since I really like the idea of atomicity of each program in unix-like approach, I would like to preserve it as much as possible in my build. Since GNU binutils, in a way, violates this principle, I would like to know if there is just GNU assembler, which...
I am trying to build my system from scratch, since I really like the idea of atomicity of each program in unix-like approach, I would like to preserve it as much as possible in my build. Since GNU binutils, in a way, violates this principle, I would like to know if there is just GNU assembler, which wouldn't be dependant on binutils? If not, are there any minimal and performant alternatives to GNU assembler? I know of yasm, but in case there is a better one, I would like to know of it. Thank you in advance.
Даниил Носиков (5 rep)
Jan 20, 2025, 08:08 AM • Last activity: Jan 20, 2025, 06:20 PM
6 votes
1 answers
4096 views
Disassemble ELF binary without section headers (program headers only) using objdump
I've got an ELF binary that contains nothing but two LOAD segments in the program header table, one for code and one for data. `readelf -a` tells me there's no section headers. If I attempt do disassemble the ARM binary on my amd64 machine with ARM cross binutils, it doesn't give me proper output. H...
I've got an ELF binary that contains nothing but two LOAD segments in the program header table, one for code and one for data. readelf -a tells me there's no section headers. If I attempt do disassemble the ARM binary on my amd64 machine with ARM cross binutils, it doesn't give me proper output. However, as far as I understand, the binary's architecture shouldn't be relevant for this question, since the issue is ELF-related.
$ file ./binary
./binary: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), statically linked, stripped

$ arm-linux-gnueabi-objdump -d ./binary 

./binary:     file format elf32-littlearm

$ arm-linux-gnueabi-objdump -x ./binary 

./binary:     file format elf32-littlearm
./binary
architecture: arm, flags 0x00000102:
EXEC_P, D_PAGED
start address 0x0004c8d8

Program Header:
    LOAD off    0x00000000 vaddr 0x00010000 paddr 0x00010000 align 2**16
         filesz 0x0003d27e memsz 0x0003d27e flags r-x
    LOAD off    0x00005c78 vaddr 0x00085c78 paddr 0x00085c78 align 2**16
         filesz 0x00000000 memsz 0x00000000 flags rw-
   STACK off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**4
         filesz 0x00000000 memsz 0x00000000 flags rw-
private flags = 5000400: [Version5 EABI] [hard-float ABI]

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
SYMBOL TABLE:
no symbols
**Is there a way to make objdump disassemble ELF segments?**
ulmer-a (229 rep)
Aug 18, 2019, 06:59 PM • Last activity: Nov 7, 2024, 02:03 PM
-1 votes
1 answers
158 views
Errors when unpacking binutils-common
So when i update kali linux with sudo apt update it shows this ``` Get:1 file:/run/live/medium kali-last-snapshot InRelease Ign:1 file:/run/live/medium kali-last-snapshot InRelease Get:2 file:/run/live/medium kali-last-snapshot Release [7,354 B] Get:2 file:/run/live/medium kali-last-snapshot Release...
So when i update kali linux with sudo apt update it shows this
Get:1 file:/run/live/medium kali-last-snapshot InRelease
Ign:1 file:/run/live/medium kali-last-snapshot InRelease
Get:2 file:/run/live/medium kali-last-snapshot Release [7,354 B]
Get:2 file:/run/live/medium kali-last-snapshot Release [7,354 B]
Get:3 file:/run/live/medium kali-last-snapshot Release.gpg
Ign:3 file:/run/live/medium kali-last-snapshot Release.gpg
Get:4 http://kali.download/kali  kali-rolling InRelease [41.2 kB]
Reading package lists... Done
E: Release file for file:/run/live/medium/dists/kali-last-snapshot/Release is not valid yet (invalid for another 24d 7h 37min 13s). Updates for this repository will not be applied.
E: Release file for http://http.kali.org/kali/dists/kali-rolling/InRelease  is not valid yet (invalid for another 47d 21h 22min 3s). Updates for this repository will not be applied.
and when i upgrade with sudo apt full-upgrade -y it shows me this
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 binutils : Depends: binutils-common (= 2.41-4) but 2.40.90.20230714-2 is installed
 binutils-x86-64-linux-gnu : Depends: binutils-common (= 2.41-4) but 2.40.90.20230714-2 is installed
 libbinutils : Depends: binutils-common (= 2.41-4) but 2.40.90.20230714-2 is installed
 libc6-dev : Depends: libc6 (= 2.37-7) but 2.37-6 is installed
 libc6-i386 : Depends: libc6 (= 2.37-7) but 2.37-6 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
and when i try sudo apt --fix-broken install show me this
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  binutils-common libc6
Suggested packages:
  glibc-doc libnss-nis libnss-nisplus
The following packages will be upgraded:
  binutils-common libc6
2 upgraded, 0 newly installed, 0 to remove and 452 not upgraded.
39 not fully installed or removed.
Need to get 0 B/5,265 kB of archives.
After this operation, 1,024 B disk space will be freed.
Do you want to continue? [Y/n] Y
Reading changelogs... Done
Preconfiguring packages ...
(Reading database ... 418244 files and directories currently installed.)
Preparing to unpack .../libc6_2.37-7_amd64.deb ...
Unpacking libc6:amd64 (2.37-7) over (2.37-6) ...
Setting up libc6:amd64 (2.37-7) ...
Setting up libstdc++6:amd64 (13.2.0-2) ...
(Reading database ... 418244 files and directories currently installed.)
Preparing to unpack .../binutils-common_2.41-4_amd64.deb ...
Unpacking binutils-common:amd64 (2.41-4) over (2.40.90.20230714-2) ...
dpkg: error processing archive /var/cache/apt/archives/binutils-common_2.41-4_amd64.deb (--unpack):
 unable to make backup link of './usr/share/locale/ms/LC_MESSAGES/gprof.mo' before installing new version: Input/output error
Errors were encountered while processing:
 /var/cache/apt/archives/binutils-common_2.41-4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
i have a kali live boot with persistence and this the third time reinstall it i need ur help
gatof (1 rep)
Sep 15, 2023, 12:22 PM • Last activity: Sep 17, 2023, 02:13 AM
0 votes
1 answers
73 views
What are the possible scl values in objdump?
The [objdump man page](https://linux.die.net/man/1/objdump) gives the following example output from `objdump -t`: > The format of the output depends upon the format of the file being dumped, but there are two main types. One looks like this: > > ``` > [ 4](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000...
The [objdump man page](https://linux.die.net/man/1/objdump) gives the following example output from objdump -t: > The format of the output depends upon the format of the file being dumped, but there are two main types. One looks like this: > >
> [  4](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .bss
> [  6](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 fred
>
> > where the number inside the square brackets is the number of the entry in the symbol table, the sec number is the section number, the fl value are the symbol's flag bits, the ty number is the symbol's type, the scl number is the symbol's storage class and the nx value is the number of auxilary entries associated with the symbol. The last two fields are the symbol's value and its name. So scl means storage class, but it never explains what scl 3 or scl 2 actually mean. Where can that information be found?
Alex Henrie (869 rep)
Jun 21, 2023, 04:03 AM • Last activity: Jun 21, 2023, 08:01 AM
0 votes
1 answers
1104 views
what target flag should I set to cross compile arm 32 bit code in gcc?
I'm trying to build a cross compiling build server for some 32 bit arm devices, where the architecture is: (from uname -m) "armv5tejl" I have to specify the target for binutils, and gcc, which looking like: --target=aarch64-linux (for example) should I expect that the target flag for my use case is...
I'm trying to build a cross compiling build server for some 32 bit arm devices, where the architecture is: (from uname -m) "armv5tejl" I have to specify the target for binutils, and gcc, which looking like: --target=aarch64-linux (for example) should I expect that the target flag for my use case is --target=armv5tejl-linux ? or how would I know the target flag to use? I tried looking in $gcc --target-help| less for help, but I dont see anything of use.
j0h (3949 rep)
Dec 23, 2022, 02:36 AM • Last activity: Dec 24, 2022, 02:07 PM
0 votes
1 answers
254 views
What is the .xs and .x* files in ldscripts?
What are these files ```text /lib/x86_64-linux-gnu/ldscripts/elf32_x86_64.xs /lib/x86_64-linux-gnu/ldscripts/elf_x86_64.xs /lib/x86_64-linux-gnu/ldscripts/elf_i386.xs /lib/x86_64-linux-gnu/ldscripts/elf_iamcu.xs /usr/lib/x86_64-linux-gnu/ldscripts/elf32_x86_64.xs /usr/lib/x86_64-linux-gnu/ldscripts/...
What are these files
/lib/x86_64-linux-gnu/ldscripts/elf32_x86_64.xs
/lib/x86_64-linux-gnu/ldscripts/elf_x86_64.xs
/lib/x86_64-linux-gnu/ldscripts/elf_i386.xs
/lib/x86_64-linux-gnu/ldscripts/elf_iamcu.xs
/usr/lib/x86_64-linux-gnu/ldscripts/elf32_x86_64.xs
/usr/lib/x86_64-linux-gnu/ldscripts/elf_x86_64.xs
/usr/lib/x86_64-linux-gnu/ldscripts/elf_i386.xs
/usr/lib/x86_64-linux-gnu/ldscripts/elf_iamcu.xs
/usr/lib/x86_64-linux-gnu/ldscripts/elf32_x86_64.xs
/usr/lib/x86_64-linux-gnu/ldscripts/elf_x86_64.xs
/usr/lib/x86_64-linux-gnu/ldscripts/elf_i386.xs
/usr/lib/x86_64-linux-gnu/ldscripts/elf_iamcu.xs
They're packaged by binutils-x86-64-linux-gnu, but how do they fit into the system? Guessing they're some kind of definition file for the system. What uses them and are they documented?
Evan Carroll (34663 rep)
Dec 14, 2022, 07:02 PM • Last activity: Dec 14, 2022, 07:27 PM
0 votes
1 answers
98 views
What are you supposed to do for "pass 2" sections in LFS
I'm trying to build an LFS system but I've hit a roadbloack, what am I supposed to do for the 2nd passes. I thought maybe I had to re-untar again then compile their but that didn't make a new directory, then I thought a build directory had to be made inside the existing folder but that doesn't work...
I'm trying to build an LFS system but I've hit a roadbloack, what am I supposed to do for the 2nd passes. I thought maybe I had to re-untar again then compile their but that didn't make a new directory, then I thought a build directory had to be made inside the existing folder but that doesn't work out either, then I tried building inside the existing build directory, then I made a build directory INSIDE the build directory but both did not help at all. I don't imagine I need to include code as I'm certain the processes I've used were incorrect. Any help would be very appreciated thanks!
Seb Ebse (13 rep)
May 9, 2021, 04:14 AM • Last activity: May 9, 2021, 09:11 AM
3 votes
1 answers
1126 views
How to build only one program in binutils
Since there are many programs that are not related to my interests, I'd like to build a specific program in GNU `binutils` on Ubuntu. Program means that one binary file (e.g., `ar`, `objcopy`) for example, I'm interested in the `ar` among the `ar`, `objdump`, `objcopy`, `readelf`, ... What should I...
Since there are many programs that are not related to my interests, I'd like to build a specific program in GNU binutils on Ubuntu. Program means that one binary file (e.g., ar, objcopy) for example, I'm interested in the ar among the ar, objdump, objcopy, readelf, ... What should I do for this? I've tried to remove other source code in binutils-version/binutils/Makefile But, Makefile still produced object files for all programs (Makefile also exists in binutils-version/) Give me a fresh idea to build one program, please.
wazz (31 rep)
Jun 26, 2020, 11:53 PM • Last activity: Jul 13, 2020, 09:01 PM
10 votes
2 answers
18512 views
What tool to use to view an object file?
I'm reading an old book on linkers and loaders and it has images of object code. But I can't figure out what tools are used to display the contents of these files. I'd appreciate if someone could point out the tool. Here is the C code and corresponding display of the object files. Source file `m.c`:...
I'm reading an old book on linkers and loaders and it has images of object code. But I can't figure out what tools are used to display the contents of these files. I'd appreciate if someone could point out the tool. Here is the C code and corresponding display of the object files. Source file m.c: extern void a(char *); int main(int argc, char **argv) { static char string[] = "Hello, world!\n"; a(string); } Source file a.c: #include #include void a(char *s) { write(1, s, strlen(s)); } Object code for m.o: Sections: Idx Name Size VMA LMA File off Algn 0 .text 00000010 00000000 00000000 00000020 2**3 1 .data 00000010 00000010 00000010 00000030 2**3 Disassembly of section .text: 00000000 : 0: 55 pushl %ebp 1: 89 e5 movl %esp,%ebp 3: 68 10 00 00 00 pushl $0x10 4: 32 .data 8: e8 f3 ff ff ff call 0 9: DISP32 _a d: c9 leave e: c3 ret ... Object code for a.o: Sections: Idx Name Size VMA LMA File off Algn 0 .text 0000001c 00000000 00000000 00000020 2**2 CONTENTS, ALLOC, LOAD, RELOC, CODE 1 .data 00000000 0000001c 0000001c 0000003c 2**2 CONTENTS, ALLOC, LOAD, DATA Disassembly of section .text: 00000000 : 0: 55 pushl %ebp 1: 89 e5 movl %esp,%ebp 3: 53 pushl %ebx 4: 8b 5d 08 movl 0x8(%ebp),%ebx 7: 53 pushl %ebx 8: e8 f3 ff ff ff call 0 9: DISP32 _strlen d: 50 pushl %eax e: 53 pushl %ebx f: 6a 01 pushl $0x1 11: e8 ea ff ff ff call 0 12: DISP32 _write 16: 8d 65 fc leal -4(%ebp),%esp 19: 5b popl %ebx 1a: c9 leave 1b: c3 ret
flashburn (691 rep)
Apr 15, 2015, 07:59 PM • Last activity: Mar 9, 2020, 04:03 PM
2 votes
1 answers
1085 views
Linux From Scratch: Error while compiling binutils 2.32
I am working on [Linux from Scratch][1] and currently, I am on [this page][2]. While compiling [binutils-2.32][3], I am getting this error: lfs@pop-os:/mnt/lfs/sources/binutils-2.32/build$ ../configure --prefix=/tools \ > --with-sysroot=$LFS \ > --with-lib-path=/tools/lib \ > --target=$LFS_TGT \ > -...
I am working on Linux from Scratch and currently, I am on this page . While compiling binutils-2.32 , I am getting this error: lfs@pop-os:/mnt/lfs/sources/binutils-2.32/build$ ../configure --prefix=/tools \ > --with-sysroot=$LFS \ > --with-lib-path=/tools/lib \ > --target=$LFS_TGT \ > --disable-nls \ > --disable-werror ../configure: line 1345: cd: /mnt/lfs/sources/binutils-2.32/build: Not a directory configure: error: working directory cannot be determined lfs@pop-os:/mnt/lfs/sources/binutils-2.32/build$ As you can see from the prompt, build is a directory. Still, it shows the error that it is not a directory. I tried to understand the code at line 1345 of configure file but unable to understand. What mistake I did in this process?
narayanpatra (123 rep)
Jun 12, 2019, 05:58 PM • Last activity: Jun 13, 2019, 08:09 PM
2 votes
1 answers
870 views
How to build and run the GNU GAS assembler test suite?
I'm at Binutils tag `binutils-2_31`, and there is a directory: gas/testsuite with some tests that I'm interested in. I've compiled the entire binutils with: ./configure make but the directory `gas/testsuite` didn't seem to be built. How to build and run those tests? Hopefully in verbose mode so I ca...
I'm at Binutils tag binutils-2_31, and there is a directory: gas/testsuite with some tests that I'm interested in. I've compiled the entire binutils with: ./configure make but the directory gas/testsuite didn't seem to be built. How to build and run those tests? Hopefully in verbose mode so I can see the full GAS command line.
Ciro Santilli OurBigBook.com (19628 rep)
Feb 8, 2019, 11:51 AM • Last activity: Feb 11, 2019, 09:05 AM
Showing page 1 of 11 total questions