[Bug binutils/24281] New: Failed with “thin archive” if it contain subdir's object file

2019-02-28 Thread qwertytmp1 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24281

Bug ID: 24281
   Summary: Failed with “thin archive” if it contain subdir's
object file
   Product: binutils
   Version: 2.26
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: qwertytmp1 at gmail dot com
  Target Milestone: ---

Please use following shell commands to reproduce the problem:

```
# create subdirectory
mkdir subdir

# create source files with dummy functions
echo 'void func1(){}' > file1.c
echo 'void func2(){}' > ./subdir/file2.c

# compiling sources into object files
gcc -c file1.c -o file1.o
gcc -c ./subdir/file2.c -o ./subdir/file2.o

# creating "thin archive" file from object files
ar crT out.a file1.o ./subdir/file2.o

# running objcopy, which leads to an error
objcopy out.a out_copy.a

```

As a result, following error occurs:

```
objcopy:st0AENRL/subdir/file2.o: No such file or directory
```

Problem with objcopy occurs when "thin" archive is composed of object files
from subdirectories.

P.S. Problem was also described on StackOverflow:
https://stackoverflow.com/questions/54907402/problem-while-using-objcopy-with-thin-archive-file

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/24281] Failed with “thin archive” if it contain subdir's object file

2019-02-28 Thread qwertytmp1 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24281

lol lol  changed:

   What|Removed |Added

Version|2.26|2.32

--- Comment #1 from lol lol  ---
Bug was reproduced on versions 2.26 and 2.32.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/24281] Failed with “thin archive” if it contain subdir's object file

2019-03-04 Thread qwertytmp1 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24281

--- Comment #3 from lol lol  ---
Hi Nick,


Q. Hmm, you do realise that copying a thin library in this way is 
   essentially the same thing as just copying it normally, right?
A. Yes. It was chosen for simplicity. Anyway, it shouldn't fail. Can you agree?


Q. The question is, what would you expect objcopy to do if you also
   had one or more of its transformation options enabled as well.  
   For example, what should this do:
 objcopy --strip-debug out.a out_copy.a
A. I expect similar behavior as for other "non-thin" object files.
   Why not to do "--strip-debug" for all included files recursively?
   It may be done in-place, or done with a copy.


Q. Would you expect objcopy to create new versions of all of the
   object files linked to within out.a, with the debugging stripped
   from the new versions ?  If so, what names should be given to
   these new object files ?  Or how about:
 objcopy out.a subdir/copy.a
   Would you expect objcopy to leave the object files intact but to
   rename the links inside copy.a so that they are valid for the
   new location of the thin library ?
A. In this case (case, when objcopy pretends to change object files), we may
   simply notify user, that object files will be rewritten and wait for the 
   confirmation.


Q. It seems to me that the easiest thing to do would be to just
   reject attempts to objcopy thin archives.  But maybe this is
   too draconian.  Would you be happy if an in-place copy of a
   thin archive was allowed, but transformations, or relocations
   were refused?
A. I think, it is not a bad idea to simply disallow objcopy for thin archives
   till the moment, when it will be supported (in alternative future).
   I think it is not of "draconian" attempt.
   This way, user of this magic tool will not be confused at all.


Thank you!

WBR,
lol lol

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/25104] New: Missing object file in resulting thin archive

2019-10-15 Thread qwertytmp1 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25104

Bug ID: 25104
   Summary: Missing object file in resulting thin archive
   Product: binutils
   Version: 2.26
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: qwertytmp1 at gmail dot com
  Target Milestone: ---

Problem occurs when creating thin archive from the file (file0.o) and from
another thin archive, which contains file with the same filename
(subfolder/file0.o).
I found this behavior of ar utility at list as strange.

It is possible to reproduce this problem using following list of commands:
```
  mkdir reproducing_ar_bug
  cd reproducing_ar_bug
  touch file0.o
  mkdir subfolder
  cd subfolder
  touch file0.o
  touch file1.o
  ar rcST built-in.o file0.o file1.o
  cd ..
  ar rcST built-in.o subfolder/built-in.o file0.o
```

In this case final built-in.o doesn't contain subfolder/file0.o:
```
  !
  //  28`
  file0.o/
  subfolder/file1.o/
  ...
```

But if change final ar command from:
```
  ar rcST built-in.o subfolder/built-in.o file0.o
```
to
```
  ar rcST built-in.o file0.o subfolder/built-in.o
```

Result is correct:
```
  !
  //  48`
  file0.o/
  subfolder/file0.o/
  subfolder/file1.o/
```


P.S. List of commands with correct behavior:
```
  mkdir reproducing_ar_bug
  cd reproducing_ar_bug
  touch file0.o
  mkdir subfolder
  cd subfolder
  touch file0.o
  touch file1.o
  ar rcST built-in.o file0.o file1.o
  cd ..
  ar rcST built-in.o file0.o subfolder/built-in.o
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/25104] Missing object file in resulting thin archive

2019-10-15 Thread qwertytmp1 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25104

lol lol  changed:

   What|Removed |Added

 CC||qwertytmp1 at gmail dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/25104] Missing object file in resulting thin archive

2019-10-17 Thread qwertytmp1 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25104

--- Comment #2 from lol lol  ---
Alan, thank you for this hint.
It works for me.


Anyway, it is a buggy behavior.

"man ar" says:
```
AR(1)
GNU Development Tools

   P   Use the full path name when matching names in the archive.  GNU ar
can not create an archive with a full path name (such archives are not POSIX
complaint), but other archive creators can.  This option will cause GNU ar to
match file names using a
   complete path name, which can be convenient when extracting a single
file from an archive created by another tool.
```

Use of this P flags leads to POSIX compliance issue.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/25104] Wrong operation when creating thin archive

2019-10-18 Thread qwertytmp1 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25104

lol lol  changed:

   What|Removed |Added

Summary|Missing object file in  |Wrong operation when
   |resulting thin archive  |creating thin archive

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/25104] Wrong operation when creating thin archive

2019-10-21 Thread qwertytmp1 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25104

--- Comment #5 from lol lol  ---
Dear Alan,


currently I have problems with access to the build machine (latest git
revision).
I have a question. Is this change fixes behavior of:
```
  mkdir reproducing_ar_bug
  cd reproducing_ar_bug
  touch file0.o
  mkdir subfolder
  cd subfolder
  touch file0.o
  touch file1.o
  ar rcST built-in.o file0.o file1.o
  cd ..
  ar rcST built-in.o subfolder/built-in.o file0.o
```
?

Thank you!

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/25104] Wrong operation when creating thin archive

2019-10-21 Thread qwertytmp1 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25104

--- Comment #7 from lol lol  ---
Thank you for clarification.
Anyway, there is a feeling that such behavior breaks some logic.
I.e., order of link objects leads to different results.
At the same time, when using P flag - result is the same.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils