Re: [PATCH v9] MIPS: force use FR=0 for FPXX binaries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 30 Mar 2021, Thomas Bogendoerfer wrote:

> I want a single go binary, which I can inspect about the FPXX thing and
> see how easy it would be to just patch the binary and make it run without
> this patch.

 I have experimented with this a bit and unfortunately a command like:

$ objcopy --remove-section=.MIPS.abiflags go go-noabiflags

will indeed remove the MIPS ABI Flags section, but will leave an empty 
ABIFLAGS segment behind:

  ABIFLAGS       0x000000 0x00400248 0x00000000 0x00000 0x00000 R   0x4

which the kernel will choke on in `arch_elf_pt_proc':

		if (phdr32->p_filesz < sizeof(abiflags))
			return -EINVAL;

or:

		if (phdr64->p_filesz < sizeof(abiflags))
			return -EINVAL;

which I think is another implementation bug; I think we should silently 
ignore an empty segment like say `readelf -A' does, that is:

		if (!phdr32->p_filesz)
			return 0;

etc.  Sadly there's no option for `objcopy' to explicitly handle segments 
anyhow including to remove empty ones.

 There's the `--update-section' section option for `objcopy' that should 
work, but it requires more effort as an image of a patched .MIPS.abiflags 
section is required (still doable).

  Maciej



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux