[SLOF] [PATCH slof] make: Define default rule for .c when V=1 or V=2

Alexey Kardashevskiy aik at ozlabs.ru
Fri Oct 1 14:54:09 AEST 2021



On 30/09/2021 20:29, Alexey Kardashevskiy wrote:
> 
> 
> On 30/09/2021 20:01, Alexey Kardashevskiy wrote:
>>
>>
>> On 31/08/2021 19:58, Thomas Huth wrote:
>>> On 31/08/2021 11.56, Thomas Huth wrote:
>>>> On 31/08/2021 11.52, Alexey Kardashevskiy wrote:
>>>>>
>>>>>
>>>>> On 31/08/2021 19:38, Thomas Huth wrote:
>>>>>> On 31/08/2021 11.30, Alexey Kardashevskiy wrote:
>>>>>>>
>>>>>>>
>>>>>>> On 31/08/2021 19:26, Thomas Huth wrote:
>>>>>>>> On 11/03/2020 03.37, Alexey Kardashevskiy wrote:
>>>>>>>>> The default .o:.c rule passes a short file name to gcc to when doing
>>>>>>>>> "make -C <dir>", we do this a lot for all the libraries.
>>>>>>>>> The file names printed in gcc errors are relative to <dir> and this
>>>>>>>>> prevents vim from navigating through errors.
>>>>>>>>>
>>>>>>>>> This passes the full file name to gcc to make it print errors with
>>>>>>>>> absolute path so vim can navigate through errors nicely.
>>>>>>>>>
>>>>>>>>> This makes it optional when V=1 or V=2 is passed.
>>>>>>>>>
>>>>>>>>> Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
>>>>>>>>> ---
>>>>>>>>>
>>>>>>>>> Or there is a better way of doing this?
>>>>>>>>>
>>>>>>>>> I find it very annoying to work with ./lib/xxxx as we chdir a lot
>>>>>>>>> and gcc does not have a flag to print full file names.
>>>>>>>>
>>>>>>>> This patch broke the compilation of "make js2x" ... thus js2x does not 
>>>>>>>> compile anymore since more than a year now. Shall we fix it, or shall 
>>>>>>>> we maybe rather remove the js2x code from the repository?
>>>>>>>
>>>>>>> It does not compile for me neither way - upstream or upstream + reverted 
>>>>>>> "make: Define default rule for .c when V=1 or V=2". It should not affect 
>>>>>>> building with V=0 anyway, unless I missed something, did I?
>>>>>>
>>>>>> For me, js2x still compiles with some warnings if I revert the patch. 
>>>>>> What error do you get?
>>>>>> (I'm getting some errors with version.h when running "make distclean" 
>>>>>> after building js2x though)
>>>>>
>>>>>
>>>>> Many "multiple definition of" like this one:
>>>>>
>>>>> [fstn1-p1 slof]$ make -j 100  js2x
>>>>> ******** Building js2x system ********
>>>>>   ====== Building clients ======
>>>>>   ====== Building common libraries ======
>>>>>   ====== Building llfw ======
>>>>>   ====== Building slof ======
>>>>>   ====== Building rtas ======
>>>>> ld: rtas_board.o:/home/aik/p/slof/board-js2x/include/bmc.h:27: multiple 
>>>>> definition of `bmc_get_blade_descr'; 
>>>>> rtas_flash.o:/home/aik/p/slof/board-js2x/include/bmc
>>>>> .h:27: first defined here
>>>>
>>>> That sounds like your compiler defaults to -fno-common now ... try to add an 
>>>> "extern" in front of that line in bmc.h to see whether that fixes the issue.
>>>
>>> Or even better: Move the line from bmc.h into board-js2x/rtas/rtas_board.c 
>>> since that's the only spot where it is used.
>>
>>
>> I poked this thing a bit.
>> https://github.com/aik/SLOF-debug/commit/3902aab6fd702aa5c1b0d7c4bd9ac9dd82ae4d71
>>
>> I has reverted "make: Define default rule for .c when V=1 or V=2" for
>> now. The error I am getting is "ld: cannot use executable file
>> 'reloc_table.o' as input to a link" which comes from:
>>
>> [fstn1-p1 rtas]$ ld -melf64ppc -nostdlib -o rtas -T
>> /home/aik/p/slof/rtas/rtas.lds /home/aik/p/slof/rtas/rtas_entry.o
>> /home/aik/p/slof/rtas/rtas_common.o /home/aik/p/slof/rtas/reloc.o
>> /home/aik/p/slof/rtas/rtas_call.o  rtas_flash.o rtas_board.o rtas_pci.o
>> rtas_out.o rtas_table.o i2c_bmc.o ipmi_oem.o ../llfw/hw.o
>> ../../lib/libc.a ../../lib/libipmi.a
>> /home/aik/p/slof/rtas/flash/block_lists.o reloc_table.o
>> ld: cannot use executable file 'reloc_table.o' as input to a link
>> [fstn1-p1 rtas]$ file reloc_table.o
>> reloc_table.o: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500,
>> version 1 (SYSV), statically linked, not stripped
>>
>> https://git.qemu.org/?p=SLOF.git;a=blob;f=board-js2x/rtas/Makefile;h=5ab5c34c74999dafd354de39b2ee1c7af305ce22;hb=HEAD#l55
>>
>>
>> I am stuck with this one, ideas how to fix that? Googling suggested "-z
>> allowexec" which is not recognized by my ld 2.36.1.
> 
> 
> 
> This helped:
> 
> diff --git a/tools/create_reloc_table.sh b/tools/create_reloc_table.sh
> index 8cacb742a701..d4790ddff0b0 100755
> --- a/tools/create_reloc_table.sh
> +++ b/tools/create_reloc_table.sh
> @@ -54,7 +54,7 @@ $OBJCOPY -O binary $TMP2.o $TMP2.bin || exit -1
>  # Create the relocation table with gen_reloc_table:
>  $DIRNAME/gen_reloc_table $TMP1.bin $TMP2.bin reloc_table.bin
> 
> -$LD -o reloc_table.o -bbinary reloc_table.bin -e0 || exit -1
> +$LD -r -o reloc_table.o -bbinary reloc_table.bin -e0 || exit -1
>  $OBJCOPY --rename-section .data=.reloc reloc_table.o reloc_table.o ||
> exit -1
> 
> 
> 
> continuing digging...


I ended up reverting it. Thanks,


ps. I pushed out everything else in the queue (which is now empty).


-- 
Alexey


More information about the SLOF mailing list